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

Suspense with Transition triggers hooks twice #1583

Closed
michaeltintiuc opened this issue Jul 14, 2020 · 2 comments · Fixed by #1588
Closed

Suspense with Transition triggers hooks twice #1583

michaeltintiuc opened this issue Jul 14, 2020 · 2 comments · Fixed by #1588

Comments

@michaeltintiuc
Copy link

Version

3.0.0-beta.21

Reproduction link

https://github.com/michaeltintiuc/vue3-suspense-transition

Steps to reproduce

<template>
      <RouterView v-slot="{ Component }">
        <Suspense>
          <template #default>
            <Transition css="false" mode="in-out" @enter="foo">
              <component :is="Component" />
            </Transition>
          </template>
        </Suspense>
      </RouterView>
</template>

The above will trigger onEnter and any other hook like onLeave etc twice

What is expected?

Call each hook once

What is actually happening?

Each hook is called twice

@michaeltintiuc
Copy link
Author

In fact currently it will call the enter hooks on page load as well, switching routes would call all of the hooks twice

@michaeltintiuc
Copy link
Author

Thank you @underfin just tested it with several scenarios with latest release, works like a charm! ❤️

@github-actions github-actions bot locked and limited conversation to collaborators Nov 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant