这是indexloc提供的服务,不要输入任何密码
Skip to content

Start transition only on page swap #60

@JoaoTeixeira20

Description

@JoaoTeixeira20

I tried to read the codebase in order to figure out when view-transition is added to the page.

I figured that the view-transition is created as soon as the link to the new url is clicked, this takes a snapshot immediately on the page, which causes a problem if you wrap router.push in a startTransition and track the pending state to animate something else (a loading spinner for example).

What happens is that the snapshot is an image that overlaps the content and so that animation is hidden.

My question is: Is it possible to create the view-transition DOM snapshots only when the page will change the content rather than when the router.push is called? That way it’s possible to show animations while next.js is preparing the next page content.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions