Skip to content

[5.x] Make sure event listener gets removed - #1348

Open
Jade-GG wants to merge 2 commits into
masterfrom
bugfix/unmounting-listeners
Open

[5.x] Make sure event listener gets removed#1348
Jade-GG wants to merge 2 commits into
masterfrom
bugfix/unmounting-listeners

Conversation

@Jade-GG

@Jade-GG Jade-GG commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

ref: HDB-1129

We ran into a rare issue where sometimes, an event listener just doesn't get removed properly on unmount when useEventListener is used. Specifically this seems to happen to the billing address graphql-mutation component. There doesn't seem to be any clear reason why this one bugs out but not the shipping address one, which is essentially exactly the same.

This is reproducible by going to the payment step and back to the credentials step, and then monitoring the event listener calls. You will see that every time you do this, another event listener will be added.

In this PR, I've added an extra code path that removes the event listener (and allowed this to be done manually with window.$on).

Ideally, this bug itself should be fixed, but I wasn't able to find it. My guess is that some very specific circumstance causes Vue3 to not properly call the cleanup callback that vueUse relies on.

@royduin

royduin commented Aug 5, 2026

Copy link
Copy Markdown
Member

Could you review this @indykoning?

@royduin

royduin commented Aug 11, 2026

Copy link
Copy Markdown
Member

Let's wait for FW-2481

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