Which @ngrx/* package(s) are the source of the bug?
signals
Minimal reproduction of the bug/regression with instructions
Signals can throw an error when they are accessed. This can happen for state
slices that are backed by APIs like resource or linkedSignal.
patchState currently calls getState internally before applying an update, so
it eagerly reads every state slice. As a result, patching an unrelated state
slice can lead to a dead-end, in that sense that other state slices are not
patchable anymore.
Reproduction
const Store = signalStore(
{ providedIn: 'root', protectedState: false },
withState({ name: '' }),
withLinkedState(() => {
const { value } = resource({
loader: async () => {
throw new Error('Failed to load value.');
},
});
return { value };
})
);
const store = inject(Store);
patchState(store, { name: 'John' });
Expected behavior
It should not block
Versions of NgRx, Angular, Node, affected browser(s) and operating system(s)
NgRx 21
Other information
No response
I would be willing to submit a PR to fix this issue
Which @ngrx/* package(s) are the source of the bug?
signals
Minimal reproduction of the bug/regression with instructions
Signals can throw an error when they are accessed. This can happen for state
slices that are backed by APIs like
resourceorlinkedSignal.patchStatecurrently callsgetStateinternally before applying an update, soit eagerly reads every state slice. As a result, patching an unrelated state
slice can lead to a dead-end, in that sense that other state slices are not
patchable anymore.
Reproduction
Expected behavior
It should not block
Versions of NgRx, Angular, Node, affected browser(s) and operating system(s)
NgRx 21
Other information
No response
I would be willing to submit a PR to fix this issue