Replies: 2 comments 1 reply
-
I can take a look at it. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi @obraud,
const config: State['config'] = { isAdmin: true }; // => compilation error There is a compilation error because const config: State['config'] = { isAdmin: true, name: undefined };
patchState(store, { config }); Stackblitz: https://stackblitz.com/edit/stackblitz-starters-jkpqnyh5?file=src%2Fmain.store.ts |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Which @ngrx/* package(s) are the source of the bug?
signals
Minimal reproduction of the bug/regression with instructions
Hello!
In NgRx 20, using
patchState
on adeepSignal
with an object missing required properties will actually remove those properties from state, resulting in errors at runtime when reading values from those missing signals.Example:
Here, calling
store.patch()
will actually removename
fromconfig
. Then any call tostore.config.name()
will result in the following errorTypeError: ctx.store.config.name is not a function
. In NgRx 19,store.config.name()
would juste returnundefined
.Here is a stackblitz for reproduction with NgRX 20. For comparison, the same repo with NgRx 19.
Expected behavior
I understand this is an edge case as it should not happen with strict typing. I am also not sure if this is intended or not,
I would expect deepSignal property structure not to evolve depending on how its patched at runtime?
Versions of NgRx, Angular, Node, affected browser(s) and operating system(s)
NgRx: 20.0.0
Angular: 20.1.3
Node: 22.17.1
Browser: Firefox, Chrome
Windows
Other information
No response
I would be willing to submit a PR to fix this issue
Beta Was this translation helpful? Give feedback.
All reactions