Skip to content

Run cleanup functions on before-cache - #1360

Open
indykoning wants to merge 4 commits into
masterfrom
bugfix/unregister-on-listeners
Open

Run cleanup functions on before-cache#1360
indykoning wants to merge 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?

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.

2 participants