angular-architects / ngrx-toolkit

Various Extensions for the NgRx Signal Store
MIT License
98 stars 16 forks source link

Cannot use `withDevTools` from `@angular-architects/ngrx-toolkit` with `@ngrx/store` and `@ngrx/effects` #47

Closed Konadu-Akwasi-Akuoko closed 2 months ago

Konadu-Akwasi-Akuoko commented 2 months ago

Hello guys,

I was trying to use the withDevtools from the ngrx-toolkit, to view my state in Redux Dev Tools like this:

export const ThemeStore = signalStore(
  { providedIn: 'root' },
  withDevtools('theme'),
  withState(initialState)
);

And inside my app.config.ts file I was also using the provideStore() and provideEffects() from ngrx, and I noticed when I used the store and effects from ngrx, the signalStore cannot appear in the redux devtools:

image

But when I removed the provideStore() and the provideEffects(), from my app.config.ts file it worked as expected:

image

When I read the docs(the README file), there was no explicit statement stating that the withDevtools feature from the @angular-architects/ngrx-toolkit will not work with the provideStore() and the provideEffects() feature from ngrx.

I may be wrong in my assessment, and I don't also know if this is the intended behaviour.

All in all, please let me know if this must be explicitly added in the README file, because maybe it is the intended behaviour, and I'll be happy to add it. Or it is a mistake on my part.

rainerhahnekamp commented 2 months ago

Hello, so I use both Signal Store and the Global Store with enabled extensions. DevTools show my my global store but also the Signal Store. That must work.

Your Redux DevTools should give you an option to switch between them. What happens if you click on the select box top right?

Screenshot 2024-05-03 at 14 43 00
Konadu-Akwasi-Akuoko commented 2 months ago

Thanks a lot @rainerhahnekamp , after I switched it, I saw that it worked. Thanks a lot, for the response. It is now working as expected.

This is with ngrx/store: image

And this is with ngrx/signals: image

Thanks for clarifying.

I don't know must it be explicitly stated in the docs, or it'll be obvious to others?

rainerhahnekamp commented 2 months ago

Great and thanks for letting us know. I think a note in the docs would not hurt.

Konadu-Akwasi-Akuoko commented 2 months ago

Great and thanks for letting us know. I think a note in the docs would not hurt.

Cool, can I go ahead and see if I can add it to the docs?

rainerhahnekamp commented 2 months ago

Sure, please go ahead!