@ngrx/signals/events: How to display event name/type in Redux DevTools? Event name always:...

Discussão em 'Angular' iniciado por Dmitriy Ivanko, Setembro 4, 2025.

  1. To display the state of signalStore in ReduxDevTools, you need to use:

    export const ServerStore = signalStore(
    withDevtools('book'),
    withEntities({ entity: type<Book>() }),
    withState<State>({ isLoading: false }),
    // some other signal store settings;
    )


    To display the name of the some method, just use updateState instead of patchState:

    withMethods((store) => ({
    onLoadingChanged(isLoading: boolean): void {
    updateState(store, 'onLoadingChanged', () => ({ isLoading }));
    },
    })),


    But how to display the name for events (@ngrx/signals/events):

    withReducer(
    on(bookApiEvents.get, () => ({ isLoading: true })),
    ),


    Here there is no way to apply updateState, and such events are always shown in Redux DevTools as 'Store Update' which makes debugging very difficult.

    I try this:

    on(bookApiEvents.getSuccess, (event, state: State) => {
    updateState<State>(state as unknown as WritableStateSource<State>, event.type, () => ({ isLoading: false }));

    return (): State => ({ isLoading: false });
    }),


    But there is console error (can not use this)

    Continue reading...

Compartilhe esta Página