Skip to content

[BUG] NextJs Link and page transition animations breaks and adds several pages. #2693

@J4v4Scr1pt

Description

@J4v4Scr1pt

I'm trying to animate transition between pages in a NextJs application (app router).
All works fine but if you click the links back and forth a bit to fast AnimatePresence will have two animation.div's.
I can't find a good solution on how to handle this.

1c5a9002ffb4587a4ee42f5f6d15a493

React tree without bugg:
image

React tree with bugg:
image

It can even add several pages:
image

Steps to reproduce:

  • Start my stackblitz
  • Click between two links back and forth and it will render page content twice.

Stackblitz:
https://stackblitz.com/edit/stackblitz-starters-xnrzd1?file=package.json,app%2Flayout.tsx,app%2FPageTransitionEffect.tsx

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions