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

Fix native modules not being re-initialized on reload #6159

Merged
2 commits merged into from
Oct 2, 2020

Conversation

tido64
Copy link
Member

@tido64 tido64 commented Oct 1, 2020

When calling ReactNativeHost::ReloadInstance(), ReactPackageProviders are not reiterated and thus not calling AddAttributedModules(). As a consequence, the native modules that were loaded the first time the app was loaded, no longer "exist" after a reload.

Microsoft Reviewers: Open in CodeFlow

When calling `ReactNativeHost::ReloadInstance()`,
`ReactPackageProvider`s are not reiterated and thus not calling
`AddAttributedModules()`. As a consequence, the native modules that were
loaded the first time the app was loaded, no longer "exist" after
a reload.
@tido64 tido64 requested a review from a team as a code owner October 1, 2020 19:07
@tido64
Copy link
Member Author

tido64 commented Oct 1, 2020

@acoates-ms: I hit this issue while trying to figure out why my DevSettings override is not loaded after a reload (microsoft/react-native-test-app#212). Not sure if this is the right fix so I would appreciate it if you could take a look or ping someone who can.

@acoates-ms
Copy link
Contributor

@vmoroz - Seems good to me but want you to check. This also seems bad. I'm surprised other people haven't hit it. It probably needs backporting?

@NickGerleman
Copy link
Collaborator

@acoates-ms instance reload was IIRC very unreliable in MSRN until 0.63. We didn't really hear feedback on it, so I'm kind of curious what development workflow looks like for the average RNW user.

@vmoroz
Copy link
Member

vmoroz commented Oct 1, 2020

@vmoroz - Seems good to me but want you to check. This also seems bad. I'm surprised other people haven't hit it. It probably needs backporting?

@acoates-ms - yes, the change is good. We did the same in private repo for the CodePush implementation. @tido64, thank you for fixing it!

Copy link
Member

@vmoroz vmoroz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@vmoroz vmoroz added the AutoMerge Causes a PR to be automatically merged once all requirements are passed (label drives bot activity) label Oct 1, 2020
@ghost
Copy link

ghost commented Oct 1, 2020

Hello @vmoroz!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

Do note that I've been instructed to only help merge pull requests of this repository that have been opened for at least 10 hours, a condition that will be fulfilled in about 7 hours 36 minutes. No worries though, I will be back when the time is right! 😉

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@vmoroz
Copy link
Member

vmoroz commented Oct 1, 2020

@tido64, please run yarn change to create the change file. It is the only check that is failing.

@ghost ghost removed the AutoMerge Causes a PR to be automatically merged once all requirements are passed (label drives bot activity) label Oct 1, 2020
@tido64
Copy link
Member Author

tido64 commented Oct 1, 2020

Thanks for the super quick review ❤️

@NickGerleman NickGerleman added the AutoMerge Causes a PR to be automatically merged once all requirements are passed (label drives bot activity) label Oct 1, 2020
@ghost ghost merged commit 489d342 into microsoft:master Oct 2, 2020
@tido64 tido64 deleted the fix-reinit-native-modules-reload branch October 2, 2020 06:44
tido64 added a commit to tido64/react-native-windows that referenced this pull request Oct 2, 2020
* Fix native modules not being re-initialized on reload

When calling `ReactNativeHost::ReloadInstance()`,
`ReactPackageProvider`s are not reiterated and thus not calling
`AddAttributedModules()`. As a consequence, the native modules that were
loaded the first time the app was loaded, no longer "exist" after
a reload.

* Change files
tido64 added a commit to tido64/react-native-windows that referenced this pull request Oct 2, 2020
When calling `ReactNativeHost::ReloadInstance()`,
`ReactPackageProvider`s are not reiterated and thus not calling
`AddAttributedModules()`. As a consequence, the native modules that were
loaded the first time the app was loaded, no longer "exist" after
a reload.
tido64 added a commit to tido64/react-native-windows that referenced this pull request Oct 2, 2020
When calling `ReactNativeHost::ReloadInstance()`,
`ReactPackageProvider`s are not reiterated and thus not calling
`AddAttributedModules()`. As a consequence, the native modules that were
loaded the first time the app was loaded, no longer "exist" after
a reload.
tido64 added a commit to tido64/react-native-windows that referenced this pull request Oct 6, 2020
When calling `ReactNativeHost::ReloadInstance()`,
`ReactPackageProvider`s are not reiterated and thus not calling
`AddAttributedModules()`. As a consequence, the native modules that were
loaded the first time the app was loaded, no longer "exist" after
a reload.
tido64 added a commit to tido64/react-native-windows that referenced this pull request Oct 7, 2020
When calling `ReactNativeHost::ReloadInstance()`,
`ReactPackageProvider`s are not reiterated and thus not calling
`AddAttributedModules()`. As a consequence, the native modules that were
loaded the first time the app was loaded, no longer "exist" after
a reload.
ghost pushed a commit that referenced this pull request Oct 7, 2020
When calling `ReactNativeHost::ReloadInstance()`,
`ReactPackageProvider`s are not reiterated and thus not calling
`AddAttributedModules()`. As a consequence, the native modules that were
loaded the first time the app was loaded, no longer "exist" after
a reload.
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AutoMerge Causes a PR to be automatically merged once all requirements are passed (label drives bot activity)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants