{"action":"created","issue":{"url":"https://api.github.com/repos/amcdnl/ngxs/issues/74","repository_url":"https://api.github.com/repos/amcdnl/ngxs","labels_url":"https://api.github.com/repos/amcdnl/ngxs/issues/74/labels{/name}","comments_url":"https://api.github.com/repos/amcdnl/ngxs/issues/74/comments","events_url":"https://api.github.com/repos/amcdnl/ngxs/issues/74/events","html_url":"https://github.com/amcdnl/ngxs/issues/74","id":305541959,"number":74,"title":"bug: Action, LazyLoadedModule and LoggerPluginModule","user":{"login":"boulix3","id":1549198,"avatar_url":"https://avatars1.githubusercontent.com/u/1549198?v=4","gravatar_id":"","url":"https://api.github.com/users/boulix3","html_url":"https://github.com/boulix3","followers_url":"https://api.github.com/users/boulix3/followers","following_url":"https://api.github.com/users/boulix3/following{/other_user}","gists_url":"https://api.github.com/users/boulix3/gists{/gist_id}","starred_url":"https://api.github.com/users/boulix3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boulix3/subscriptions","organizations_url":"https://api.github.com/users/boulix3/orgs","repos_url":"https://api.github.com/users/boulix3/repos","events_url":"https://api.github.com/users/boulix3/events{/privacy}","received_events_url":"https://api.github.com/users/boulix3/received_events","type":"User","site_admin":false},"labels":[{"id":868342246,"url":"https://api.github.com/repos/amcdnl/ngxs/labels/investigate","name":"investigate","color":"ffebb5","default":false}],"state":"open","locked":false,"assignee":{"login":"deebloo","id":6563621,"avatar_url":"https://avatars0.githubusercontent.com/u/6563621?v=4","gravatar_id":"","url":"https://api.github.com/users/deebloo","html_url":"https://github.com/deebloo","followers_url":"https://api.github.com/users/deebloo/followers","following_url":"https://api.github.com/users/deebloo/following{/other_user}","gists_url":"https://api.github.com/users/deebloo/gists{/gist_id}","starred_url":"https://api.github.com/users/deebloo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deebloo/subscriptions","organizations_url":"https://api.github.com/users/deebloo/orgs","repos_url":"https://api.github.com/users/deebloo/repos","events_url":"https://api.github.com/users/deebloo/events{/privacy}","received_events_url":"https://api.github.com/users/deebloo/received_events","type":"User","site_admin":false},"assignees":[{"login":"deebloo","id":6563621,"avatar_url":"https://avatars0.githubusercontent.com/u/6563621?v=4","gravatar_id":"","url":"https://api.github.com/users/deebloo","html_url":"https://github.com/deebloo","followers_url":"https://api.github.com/users/deebloo/followers","following_url":"https://api.github.com/users/deebloo/following{/other_user}","gists_url":"https://api.github.com/users/deebloo/gists{/gist_id}","starred_url":"https://api.github.com/users/deebloo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deebloo/subscriptions","organizations_url":"https://api.github.com/users/deebloo/orgs","repos_url":"https://api.github.com/users/deebloo/repos","events_url":"https://api.github.com/users/deebloo/events{/privacy}","received_events_url":"https://api.github.com/users/deebloo/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2018-03-15T12:57:13Z","updated_at":"2018-03-19T09:13:19Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Hello, there is a bug occuring with actions on lazy loaded modules, but only when LoggerPluginModule is imported.\r\n\r\nI have tried to make the example as simple as possible : \r\nThe button dispatches an event which is watched by an action.\r\nThe action simply dispatches an event which is watched by a mutation.\r\n\r\nStackblitz example : \r\nhttps://stackblitz.com/edit/ngxs-lazy-loaded-module?file=main.ts\r\n\r\n\r\nRepro steps : \r\nNavigate to the lazy loaded module by clicking on the \"toggle component\" button\r\nClicking the \"Toggle visibility\" button raises an error (action managed on ToggleStore imported with forFeature). \r\n\r\n\r\nIf we remove the LoggerPluginModule import, everything works fine."},"comment":{"url":"https://api.github.com/repos/amcdnl/ngxs/issues/comments/374145815","html_url":"https://github.com/amcdnl/ngxs/issues/74#issuecomment-374145815","issue_url":"https://api.github.com/repos/amcdnl/ngxs/issues/74","id":374145815,"user":{"login":"boulix3","id":1549198,"avatar_url":"https://avatars1.githubusercontent.com/u/1549198?v=4","gravatar_id":"","url":"https://api.github.com/users/boulix3","html_url":"https://github.com/boulix3","followers_url":"https://api.github.com/users/boulix3/followers","following_url":"https://api.github.com/users/boulix3/following{/other_user}","gists_url":"https://api.github.com/users/boulix3/gists{/gist_id}","starred_url":"https://api.github.com/users/boulix3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boulix3/subscriptions","organizations_url":"https://api.github.com/users/boulix3/orgs","repos_url":"https://api.github.com/users/boulix3/repos","events_url":"https://api.github.com/users/boulix3/events{/privacy}","received_events_url":"https://api.github.com/users/boulix3/received_events","type":"User","site_admin":false},"created_at":"2018-03-19T09:13:18Z","updated_at":"2018-03-19T09:13:18Z","author_association":"CONTRIBUTOR","body":"I've updated my sample app on stackblitz, it can help understand the new @Action decorator and its parameters.\r\n\r\nhttps://stackblitz.com/edit/ngxs-lazy-loaded-module?file=app%2Fapp.state.ts\r\n\r\n```typescript\r\nimport {Action, Store,State, StateContext } from 'ngxs';\r\n\r\n/**\r\n * In this example, an \"Add\" action is dispatched by the component.\r\n * the addRaiseAnotherAction method is then called and then dipatches a \"DoAdd\" action.\r\n * the addPatchState method is then called and patches the state.\r\n */\r\n\r\nexport class Add {}\r\nexport class DoAdd {}\r\n@State({\r\n  defaults: {\r\n    count: 0\r\n  }\r\n})\r\nexport class AppState {\r\n  @Action(DoAdd)\r\n  addPatchState(context:StateContext<any>) {    \r\n    let state = context.getState();\r\n    context.patchState({count:state.count+1});\r\n  }\r\n\r\n  @Action(Add)\r\n  addRaiseAnotherAction(context:StateContext<any>){\r\n    context.dispatch(new DoAdd());\r\n  }\r\n}\r\n```"}}
{"actor":{"display_login":"boulix3"}}