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

mounted called on navigation but render is delayed #12810

Closed
vuejstime opened this issue Nov 23, 2021 · 2 comments
Closed

mounted called on navigation but render is delayed #12810

vuejstime opened this issue Nov 23, 2021 · 2 comments

Comments

@vuejstime
Copy link

Environment

Nuxt CLI v3.0.0-27292434.d68318f

  • Operating System: Linux
  • Node Version: v16.11.1
  • Nuxt Version: 3.0.0-27292434.d68318f
  • Package Manager: yarn@1.22.5
  • Bundler: Vite
  • User Config: buildModules, windicss, css
  • Runtime Modules: -
  • Build Modules: nuxt-windicss@2.0.12

Reproduction

 onMounted(() => {
      nextTick(()=>{
         gsap.registerPlugin(ScrollToPlugin)
      const tl = new gsap.timeline();
      tl.from(".g-head-anime", {
        ease: "power4",
        duration: 0.8,
        autoAlpha: 0,
        x: 200,
        stagger: 0.3,
        onComplete: () => {
          completeAnimation.value = true;
          gsap.set(".g-head-anime", { clearProps: "transform" });
        },
      })
      });
    });

am using gsap for animate some text on mounted i even used nextTick but issue is still exist

Describe the bug

the issue is : when am hard reload the page it's totally okay but when i navigate to the page gsap can't file the node with class g-head-anime that's mean during navigate mount called a little faster than dome render. but when i'm setting time out in mounted it works as expected.

Additional context

No response

Logs

No response

@danielroe
Copy link
Member

I think this is not an issue with Nuxt, but with how the Vue rendering lifecycle works (and possibly also how your component is being rendered). I'd recommend you raise this as a discussion instead of a bug report.

@fanckush
Copy link

@vuejstime here's a workaround #13471

@danielroe danielroe added the 3.x label Jan 19, 2023
@danielroe danielroe transferred this issue from nuxt/framework Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants