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(runtime-core): Lifecycle hooks should support callbacks shared by reference (fix #6686) #6687

Merged
merged 1 commit into from Sep 27, 2022

Conversation

LinusBorg
Copy link
Member

the current deduping implementation of injectHook relies on lifecycle callbacks always being created within setup.

When using i.e. an imported function directly as a hook callback, it will not reliably be run for each instance of a component.

This PR wraps each received callback in another arrow function in in order to ensure that each component instance has its own distinct copy of the callback.

@LinusBorg LinusBorg force-pushed the linusborg/fix-shared-hook-callback-6686 branch from 6d6561d to 2fad93c Compare September 17, 2022 09:57
@LinusBorg LinusBorg linked an issue Sep 26, 2022 that may be closed by this pull request
@yyx990803 yyx990803 merged commit c71a08e into main Sep 27, 2022
13 checks passed
@yyx990803 yyx990803 deleted the linusborg/fix-shared-hook-callback-6686 branch September 27, 2022 02:18
chrislone pushed a commit to chrislone/core that referenced this pull request Feb 4, 2023
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

Successfully merging this pull request may close these issues.

onBeforeUnmount not triggering callback
2 participants