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

Transition TypeError with multiple listeners #3227

Closed
KaelWD opened this issue Feb 12, 2021 · 4 comments
Closed

Transition TypeError with multiple listeners #3227

KaelWD opened this issue Feb 12, 2021 · 4 comments
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. 🐞 bug Something isn't working scope: transition

Comments

@KaelWD
Copy link
Contributor

KaelWD commented Feb 12, 2021

Version

3.0.5

Reproduction link

https://codepen.io/kaelwd/pen/poNNMQN?editors=1010

Steps to reproduce

Click the toggle button

What is expected?

The grey square should hide

What is actually happening?

Uncaught (in promise) TypeError: onLeave is not a function

Worked in Vue 2: https://codepen.io/kaelwd/pen/poNNMBe?editors=1010

@LinusBorg LinusBorg added 🐞 bug Something isn't working 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. scope: transition labels Feb 12, 2021
@LinusBorg
Copy link
Member

LinusBorg commented Feb 12, 2021

The current implementation allows to receive an array of callbacks in the transition's prop definition, but calls it like a function, without checking for an array:

I assume onLeave should be called with callHook like the other hooks, but right now I'm not sure if there's any side effect with callHook's async error handling that should be taken into consideration, will need to take a closer look tomorrow after some sleep.

Likely a simple fix.

@LinusBorg LinusBorg self-assigned this Feb 12, 2021
@nrgnrg
Copy link
Contributor

nrgnrg commented Feb 24, 2021

callHook was removed from Transition in #1145 bf84ac8.

Error handling is done by BaseTransition but callHook wasn't replaced with something that can call an array of functions if that's what it is given.

I'm happy to look at this but I'm just unclear on this condition if (!(onLeave && onLeave.length > 1)) which has to be true to call whenTransitionEnds. Not calling that means the transition never completes. But since onLeave doesn't mutate there seems to be no reason to check it's length to call or not call whenTransitionEnds?

@LinusBorg LinusBorg removed their assignment Mar 9, 2021
@edison1105
Copy link
Member

edison1105 commented Mar 10, 2021

onLeave is an Array

@LinusBorg LinusBorg self-assigned this Mar 10, 2021
@LinusBorg
Copy link
Member

Was already working on a solution, got a bit stumped by some Type confusion on my side. Will give it another go now though.

@LinusBorg LinusBorg removed their assignment May 6, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. 🐞 bug Something isn't working scope: transition
Projects
None yet
Development

No branches or pull requests

4 participants