Skip to content

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
@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

3 participants