You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: v21-blog-post.md
+59-1Lines changed: 59 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,8 @@ As easy as `withStorageSync('storeNameHere')`. IndexedDB was added last year by
26
26
-`withFeature` of the SignalStore started out in the Toolkit as `withFeatureFactory`
27
27
- Other features can be found in the documentation: https://ngrx-toolkit.angulararchitects.io/docs/extensions
28
28
29
+
// TODO - some snippets? Screenshot(s)?
30
+
29
31
## But first: v20 minor features: `withResource`/`withEntityResources`/Mutations
30
32
31
33
Before talking about v21, there were two new features from v20 Toolkit minor versions: `withResource()` and its
@@ -39,11 +41,65 @@ The Mutations API came in a later minor, providing the other pieces of the REST
39
41
standalone functions (`httpMutation`/`rxMutation`), as well as in a `withMutation` feature. The API was inspired by Angular Query and Marko Stanimirović's
40
42
proposed mutations API for Angular. We also had internal discussions with Alex Rickabaugh on our design.
41
43
44
+
// TODO - snippets?
45
+
42
46
## TODO: v21
43
47
48
+
Finally, actual Toolkit v21 notes. Future posts that are not our debut blogpost for the library won't always have a three act structure with a detailed backstory, we promise.
49
+
50
+
The two major items for v21 tie into topics we already discussed:
51
+
52
+
- Better error handling for `withResource()` and `withEntityResources()`
53
+
- Events integration into the devtools
54
+
55
+
### Upgraded `withResource()` and `withEntityResources()` error handling
56
+
57
+
The error throwing behavior of Angular's resources proved tricky for the signal store. Deadlock scenario: once a resource is in an
58
+
error state and we update a signal in `params`, the update calls `patchState`, which will again access the value of the state.
59
+
60
+
After a lot of experiemtnation, as well as discussion with various members of the Angular community, we arrived on an error handling
{ errorHandling: 'undefined value' }, // default if not specified
79
+
),
80
+
```
81
+
82
+
Options:
83
+
84
+
1.`'undfined value'` (default). In the event of an error, the resource's value will be `undefined`
85
+
1.`'previous value'`. Provided the resource had a previous value, that previous value will be returned. If not, an error is thrown.
86
+
1.`'native'`. No special handling is provided, inline with default error behavior.
87
+
88
+
<!-- TODO - update link when the code is merged -->
89
+
90
+
Under the hood, `'previous value'` and `'undefined value'` proxy the value. For a detailed explanation for why this is done and what a more longterm solution may be with some framework enhancements, check out the [JSDoc for the error handling strategy](https://google.com).
91
+
44
92
### Events integration into devtools
45
93
46
-
### Upgraded `withResource`
94
+
There is some irony with this. The NgRx Toolkit brought events to the SignalStore before there was an official plugin, and the Toolkit
95
+
provides Redux Devtools integration, with or without redux used. However, the now official NgRx events feature as it shaped up
96
+
did not translate directly to working with the Toolkit's `withDevtools`.
97
+
98
+
In NgRx Toolkit v21, we are fixing this with `withTrackedReducer()`, an alternative approach to tracking reducer-based state changes in Redux DevTools.
99
+
100
+
```ts
101
+
// TODO - snippet with imports
102
+
```
47
103
48
104
## TODO (also decide location) - where to mention Murat's OpenAPI library based on the toolkit
49
105
@@ -59,3 +115,5 @@ An OpenAPI generator that creates:
59
115
On top of that, the generated code is genuinely beautiful – which is not something you usually
60
116
see with code generators. [Check it out on npm](https://www.npmjs.com/package/ngrx-toolkit-openapi-gen),
61
117
as well as [its documentation](https://coderabbit-gmbh.github.io/ngrx-toolkit-openapi-gen/).
118
+
119
+
## TODO - where to put this and what to say - our strategy to release a compatible minor with the next major in the future in a more timely manor
0 commit comments