Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addModule doesn't initialize reactions #1439

Open
fmal opened this issue Dec 9, 2021 · 0 comments
Open

addModule doesn't initialize reactions #1439

fmal opened this issue Dec 9, 2021 · 0 comments

Comments

@fmal
Copy link
Contributor

fmal commented Dec 9, 2021

I noticed that when adding a module definition that has some reactions defined, the reaction handlers are not firing. Digging deeper i have found out that reactions are created with .create() method https://github.com/cerebral/cerebral/blob/next/packages/node_modules/cerebral/src/Module.js#L120 but they're not initialized. Initialization (with .initialize() method) happens only on https://github.com/cerebral/cerebral/blob/next/packages/node_modules/cerebral/src/Controller.js#L51 root module/controller creation only for statically defined modules. Dynamically added modules with addModule don't get initialized (similarly removeModule should destroy them i believe).
This is contrary to reactions in views https://github.com/cerebral/cerebral/blob/next/packages/node_modules/cerebral/src/View.js#L251 which are initialized upon creation and destroyed when unmounting: https://github.com/cerebral/cerebral/blob/next/packages/node_modules/cerebral/src/View.js#L145.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant