Closed dreamstar-enterprises closed 1 month ago
I think I fixed it. I had to update my set function to this:
setContractTouched(contract: AnyContractDTO): void {
const newContract = { ...contract } --> added
patchState(store,{ contractTouched: newContract } );
},
That's the only way I could re-trigger the computed signal in the withComputed block
Which @ngrx/* package(s) are the source of the bug?
signals
Minimal reproduction of the bug/regression with instructions
For some reason,
Does not properly calculate a new flattenedContractTouched() when store.contractTouched() changes. When I call it, it keeps returning the old contract (the one when the store initialised)
This works perfectly fine (I get the updated contract in the store, but not flattened)
The flattenObject function is just this, in the service: UtilityService
Running this line in a component works perfectly fine, it returns the updated contract, flattened too
console.log(utilityService.flattenObject(this.contractStore.contractTouched())
which is why I narrowed down to an ngrx withComputed bug:
Expected behavior
Shouldn't computed just work, in ngRX even if using an injected service function
Versions of NgRx, Angular, Node, affected browser(s) and operating system(s)
latest ngrx
Other information
n/a
I would be willing to submit a PR to fix this issue