Commit 04d4dc9
authored
fix(android): remove runBlocking from property accessors (#288)
Property accessors (`numberProperty`, `stringProperty`, etc.) were using
`runBlocking { flow.first() }` as an existence probe before returning
the wrapper. This blocks the calling thread and can deadlock if called
from the main thread (e.g. via a worklet).
The iOS experimental backend already does the right thing — it just
creates and returns the wrapper directly. This PR aligns Android
experimental to the same behaviour: return a wrapper always, fail lazily
when `getValueAsync()` is called on an invalid path.
Also removes the `propertyNames` lazy val (used for `hasProperty`) which
had its own one-time `runBlocking` call.
Test: updated guard for the "non-existent returns undefined" test (skips
on all experimental backends), added new test asserting
`getValueAsync()` rejects for invalid paths on experimental.1 parent 0278a65 commit 04d4dc9
2 files changed
Lines changed: 43 additions & 78 deletions
File tree
- android/src/new/java/com/margelo/nitro/rive
- example/__tests__
Lines changed: 12 additions & 73 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | 10 | | |
13 | 11 | | |
14 | 12 | | |
| |||
23 | 21 | | |
24 | 22 | | |
25 | 23 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | 24 | | |
43 | 25 | | |
44 | 26 | | |
| |||
56 | 38 | | |
57 | 39 | | |
58 | 40 | | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 41 | + | |
| 42 | + | |
68 | 43 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 44 | + | |
| 45 | + | |
78 | 46 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
| 47 | + | |
| 48 | + | |
88 | 49 | | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
| 50 | + | |
| 51 | + | |
98 | 52 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
| 53 | + | |
| 54 | + | |
108 | 55 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
| 56 | + | |
| 57 | + | |
118 | 58 | | |
119 | 59 | | |
120 | 60 | | |
| |||
144 | 84 | | |
145 | 85 | | |
146 | 86 | | |
147 | | - | |
148 | 87 | | |
149 | 88 | | |
150 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
157 | 155 | | |
158 | 156 | | |
159 | 157 | | |
| |||
167 | 165 | | |
168 | 166 | | |
169 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
170 | 196 | | |
171 | 197 | | |
172 | 198 | | |
| |||
0 commit comments