Andreas-Hjortland / ngxs-message-plugin

An NGXS plugin which allows you to share state between different browser contexts
https://andreas-hjortland.github.io/ngxs-message-plugin/
MIT License
3 stars 1 forks source link

[BUG] Cannot add the child plugin standalone in `provideStates` #21

Open Andreas-Hjortland opened 1 month ago

Andreas-Hjortland commented 1 month ago

Describe the bug Because we are adding the plugin using the NGXS_PLUGINS injection token instead of the withNgxsPlugin, we cannot load the plugin on a lazy loaded route, but have to do it in the entry point (where we call provideStore.

To Reproduce

Expected behavior Expected the state to change when the child handler receives the events from the parent handler.

Desktop (please complete the following information):

Andreas-Hjortland commented 1 month ago

I cannot fix this until we have updated minimum required version to angular 18, until then the workaround will be to use module based providers or add the plugin in the root of the app, and let any child pages be bootstrapped individually instead of as angular routes.

Andreas-Hjortland commented 1 month ago

Also depends on this fix https://github.com/ngxs/store/issues/2227