Skip to content

Run cleanup functions on before-cache - #1360

Merged
royduin merged 4 commits into
masterfrom
bugfix/unregister-on-listeners
Sep 8, 2026
Merged

royduin merged 4 commits into
masterfrom
bugfix/unregister-on-listeners

Conversation

@indykoning

@indykoning indykoning commented Aug 17, 2026 •

Copy link
Copy Markdown
Member

Since Vue 3 functionality regarding unmounting has changed with useEventListener.
This results in the cleanup function only being called for useEventListener calls done within a .vue component.

This caused e.g. addToCart listeners of the gtm package to start stacking the same event listener.
Luckily useEventListener also returns the cleanup function, we unmount Vue on turbo:before-cache so we can cleanup the listeners ourselves.

Ref: FW-2481

@indykoning
indykoning requested a review from royduin as a code owner August 17, 2026 09:02
@indykoning
indykoning requested a review from Jade-GG August 17, 2026 10:50
@Jade-GG

Jade-GG commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

How much value is there still to using useEventListener here if we have to clean the event listeners up ourselves anyway?

@royduin
royduin merged commit 09db159 into master Sep 8, 2026
28 of 29 checks passed
@royduin
royduin deleted the bugfix/unregister-on-listeners branch September 8, 2026 09:50
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.

3 participants