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

Nextjs route change gives error #1

Closed
waltervanwoudenberg opened this issue May 9, 2024 · 5 comments
Closed

Nextjs route change gives error #1

waltervanwoudenberg opened this issue May 9, 2024 · 5 comments

Comments

@waltervanwoudenberg
Copy link

Hello,

When I use the player in two different pages: /login and /signup I get the following error when going from one page to the other:

Unhandled Runtime Error
Error: This ChildPart has no parentNode and therefore cannot accept a value. This likely means the element containing the part was manipulated in an unsupported way outside of Lit's control such that the part's marker nodes were ejected from DOM. For example, setting the element's innerHTML or textContent can do this.

The component im using looks like this:

"use client";
import "@aarsteinmedia/dotlottie-player-light";

export default function DotLottieReact() {
  return (
    <dotlottie-player
      class=""
      autoplay=""
      loop=""
      subframe=""
      src="/fire-animation.lottie"
      style={{
        height: 950,
        width: "100%",
        display: "flex",
      }}
    />
  );
}

Do you have any idea how to fix this issue?

@johanaarstein
Copy link
Contributor

Hi! Do you get the error during production or when running locally?

@waltervanwoudenberg
Copy link
Author

Hi! Do you get the error during production or when running locally?

I got it only when running locally in dev mode, but what I do get in production and during dev is the animation stops playing when I focus/click on an input element or when I click in my dev tools. So somehow when the focus is somewhere else it stops playing.

@johanaarstein
Copy link
Contributor

That's by design – to keep the animation from using CPU when the browser window isn't active. Input elements should maybe be excluded from this behavior, though. 🤔 I'll probably add it in the next update. 😇

@johanaarstein
Copy link
Contributor

The error message, by the way, is common when using Lit-based web components with React in dev-mode. It's caused by the extra re-renders React does when in dev-mode.

@johanaarstein
Copy link
Contributor

Version 3 out now, without Lit – so without this issue 😎

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

No branches or pull requests

2 participants