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

Add module.onAnyUpdate hook that triggers every time after reloading event #160

Open
tancredi opened this issue Nov 2, 2017 · 1 comment

Comments

@tancredi
Copy link

tancredi commented Nov 2, 2017

Firstly, thanks for building this tool - I'm trying to improve the build / watch workflow of an app I'm working on and being able to move back to Browserify makes a huge difference.

Now, here's the issue: I have a fairly complex app which uses custom routing and a custom router module - the routes and views are not declarative, so they don't get included directly in the react renders but they get pulled out of a JS object elsewhere, with their associated components.

The component modules get reloaded all right, though they don't get re-rendered for whatever reason. My understanding is onUpdate only is called on the module it's scope within, while what I'd like to have is a hood that is triggered on 'any module update' to be able manually trigger a re-render.

It would be pretty repetitive to add an extra line to each of my views to communicate externally a re-render is due. A simple global callback hook for all module reloads event would be enough for this kind of use-case, and I'm sure could come handy to other people, too. Thoughts?

@milankinen
Copy link
Owner

Hello @tancredi!

Yes, that is a very good proposal and doable pretty easily! 👍 First you should add new onAnyUpdate method to the module here which adds some kind of listener to reload events. And after reload has happened, invoke those listeners here.

I'd gladly accept any pull request adding this feature! 😄

@milankinen milankinen changed the title .onAnyUpdate ? Add module.onAnyUpdate hook that triggers every time after reloading event Nov 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants