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

How does HMR handle updating all references? #13

Open
jgarvin opened this issue Oct 17, 2024 · 1 comment
Open

How does HMR handle updating all references? #13

jgarvin opened this issue Oct 17, 2024 · 1 comment

Comments

@jgarvin
Copy link

jgarvin commented Oct 17, 2024

In python if module A does a import moduleB then you reload module B, inside module A it will still be referring to the old version of module B. I was curious how you solved this, and I see __recursive_reload checking every attr of the given module recursively to find other modules that need reloading, but I don't see it updating those references. Does every module that imports module B need to explicitly call hmr.reload(moduleB) for this to work?

@Mr-Milk
Copy link
Owner

Mr-Milk commented Oct 18, 2024

Hi, thanks for asking. It's a recursive function that returns itself, so yes, it will reload all the modules that need to be reloaded.

You only need to call the hmr.reload for the highest level import.

Feel free to ask if you have further questions! I'm happy to answer.

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

2 participants