@ngrx/signals: Extension Point stateChange #4192
Unanswered
rainerhahnekamp
asked this question in
Q&A
Replies: 1 comment 5 replies
-
This is already possible by using the import { getState } from '@ngrx/signals';
withHooks({
onInit(store) {
effect(() => {
const state = getState(store);
console.log('state changed', state); // state will be logged on changes
});
}
}) |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Which @ngrx/* package(s) are relevant/related to the feature request?
signals
Information
It would be nice for the devtools community plugin to get an extension point which notifies about state changes:
Approach 1: Hooks
The existing hooks get a new callback like
onChange
oronStateChange
. DevTools could register then, and we're done.Approach 2: Standalone Function
Or we do it via a standalone method like
watchStateChange(state: STATE_SIGNAL, callbackFn: (value: unknown) => void)
Describe any alternatives/workarounds you're currently using
At the moment, there are some workarounds which only work with very strict constraints. Like using a modified
patchState
function.I would be willing to submit a PR to fix this issue
Beta Was this translation helpful? Give feedback.
All reactions