Commit 03ccb2e
authored
Fixes 4331 Handle null load state; add tests (#4349)
<!-- Please be sure to read our [Contribute
guide](https://www.reactiveui.net/contribute/index.html) before opening
a PR. -->
## What kind of change does this PR introduce?
<!-- Bug fix, feature, docs update, refactor, ci, ... -->
Fix
## What is the current behavior?
<!-- You can also link to an open issue here. Use "Closes #123" to
auto-close on merge. -->
Closes #4331
## What is the new behavior?
<!-- If this is a feature change -->
Do not assign a potentially-null loaded state directly to
AppState/AppStateValue.
Capture the result of ISuspensionDriver.LoadState into a local (object?
/ TAppState?) and assign item.AppState/item.AppStateValue to the loaded
value or fallback to CreateNewAppState/CreateNewAppStateTyped.
Add tests in SuspensionHostExtensionsTests and
SuspensionHostExtensionsAotTests that verify GetAppState creates and
stores a new app state when no persisted state exists.
Add ReturnNullOnLoad to TestSuspensionDriver to simulate drivers
returning null.
Change SuspensionHostTestExecutor to inherit from AppBuilderTestExecutor
and delegate ExecuteTest to the base implementation (and add the
required using).
These changes ensure null-returning drivers are handled safely and
covered by tests.
## What might this PR break?
## Checklist
- [x] I have read the [Contribute
guide](https://www.reactiveui.net/contribute/index.html)
- [x] Tests have been added or updated (for bug fixes / features)
- [ ] Docs have been added or updated (for bug fixes / features)
- [x] Changes target the `main` branch
- [x] PR title follows [Conventional
Commits](https://www.conventionalcommits.org/)
## Additional information1 parent 2be6785 commit 03ccb2e
4 files changed
Lines changed: 84 additions & 7 deletions
File tree
- src
- ReactiveUI/Suspension
- tests
- ReactiveUI.Test.Utilities/SuspensionHost
- ReactiveUI.Tests
- Suspension
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
| 287 | + | |
| 288 | + | |
287 | 289 | | |
288 | 290 | | |
289 | | - | |
| 291 | + | |
290 | 292 | | |
291 | 293 | | |
292 | 294 | | |
293 | 295 | | |
294 | | - | |
| 296 | + | |
295 | 297 | | |
296 | 298 | | |
| 299 | + | |
| 300 | + | |
297 | 301 | | |
298 | 302 | | |
299 | 303 | | |
| |||
321 | 325 | | |
322 | 326 | | |
323 | 327 | | |
| 328 | + | |
| 329 | + | |
324 | 330 | | |
325 | 331 | | |
326 | | - | |
| 332 | + | |
327 | 333 | | |
328 | 334 | | |
329 | 335 | | |
330 | 336 | | |
331 | | - | |
| 337 | + | |
332 | 338 | | |
333 | 339 | | |
| 340 | + | |
| 341 | + | |
334 | 342 | | |
335 | 343 | | |
336 | 344 | | |
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| |||
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
20 | | - | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
26 | | - | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
34 | | - | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
Lines changed: 30 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
72 | 102 | | |
73 | 103 | | |
74 | 104 | | |
| |||
Lines changed: 37 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
127 | 157 | | |
128 | 158 | | |
129 | 159 | | |
| |||
475 | 505 | | |
476 | 506 | | |
477 | 507 | | |
| 508 | + | |
| 509 | + | |
478 | 510 | | |
479 | 511 | | |
480 | 512 | | |
| |||
497 | 529 | | |
498 | 530 | | |
499 | 531 | | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
500 | 537 | | |
501 | 538 | | |
502 | 539 | | |
| |||
0 commit comments