Skip to content

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

Merged
2 commits merged into
microsoft:masterfrom
tido64:fix-reinit-native-modules-reload
Oct 2, 2020
Merged

Fix native modules not being re-initialized on reload#6159
2 commits merged into
microsoft:masterfrom
tido64:fix-reinit-native-modules-reload

Conversation

@tido64

@tido64 Tommy Nguyen (tido64) commented Oct 1, 2020

Copy link
Copy Markdown
Member

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
Tommy Nguyen (tido64) requested a review from a team as a code owner October 1, 2020 19:07
@tido64

Copy link
Copy Markdown
Member Author

Andrew Coates (@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
Copy Markdown
Contributor

Vladimir Morozov (@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
Copy Markdown
Contributor

Andrew Coates (@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
Copy Markdown
Member

Vladimir Morozov (@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?

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

@vmoroz Vladimir Morozov (vmoroz) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

:shipit:

@vmoroz Vladimir Morozov (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
Copy Markdown

Hello Vladimir Morozov (@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
Copy Markdown
Member

Tommy Nguyen (@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
Copy Markdown
Member Author

Thanks for the super quick review ❤️

@NickGerleman Nick Gerleman (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
Tommy Nguyen (tido64) deleted the fix-reinit-native-modules-reload branch October 2, 2020 06:44
Tommy Nguyen (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
Tommy Nguyen (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.
Tommy Nguyen (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.
Tommy Nguyen (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.
Tommy Nguyen (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