Commit d962dd9
Fix stale closures of event handlers (#76)
* Fix stale closures of callback options in inputs.text et. al.
The implementation of useFormState is problematic because it
caches callback functions passed to inputs.text et. al. This
causes functions like onChange, validate, and onBlur to run with
stale closures, namely, the closure with which they are
initialised.
This commit fixes the issue by removing the `callback` cache from
the implementation. Tests that depended on this buggy behavior
were removed as they are unsupportable features given the current
implementation.
* Re-add getOrSet to useCache1 parent e97049a commit d962dd9
3 files changed
Lines changed: 4 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | 49 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | 15 | | |
18 | 16 | | |
19 | 17 | | |
| |||
31 | 29 | | |
32 | 30 | | |
33 | 31 | | |
34 | | - | |
35 | 32 | | |
36 | 33 | | |
37 | 34 | | |
| |||
202 | 199 | | |
203 | 200 | | |
204 | 201 | | |
205 | | - | |
| 202 | + | |
206 | 203 | | |
207 | 204 | | |
208 | 205 | | |
| |||
252 | 249 | | |
253 | 250 | | |
254 | 251 | | |
255 | | - | |
256 | | - | |
| 252 | + | |
| 253 | + | |
257 | 254 | | |
258 | 255 | | |
259 | 256 | | |
| |||
269 | 266 | | |
270 | 267 | | |
271 | 268 | | |
272 | | - | |
| 269 | + | |
273 | 270 | | |
274 | 271 | | |
275 | 272 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
534 | 534 | | |
535 | 535 | | |
536 | 536 | | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
551 | | - | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | | - | |
556 | | - | |
0 commit comments