Skip to content

Conversation

@pascalbaljet
Copy link
Member

This PR adds support for View Transitions, building upon the great work done in #2421. It has some advantages over the original PR.

  • Introduces no new interfaces/types
  • Uses the standard ViewTransition interface
  • Works with Client-Side Visits
  • Comes with tests

View transitions can be enabled by using the viewTransition option when making a visit.

router.visit('/another-page', { viewTransition: true })

You may also pass a callback, which will receive the ViewTransition instance.

router.visit('/another-page', {
  viewTransition: (transition) => {
    transition.ready.then(() => doSomething())
    transition.updateCallbackDone.then(() => doSomething())
    transition.finished.then(() => doSomething())
  },
})

Combined with the new configuration feature from PR #2655, you may enable this globally.

createInertiaApp({
  // resolve, setup, etc.
  defaults: {
    visitOptions: (href: string, options: VisitOptions) => {
      return { viewTransition: true }
    },
  },
})

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

Successfully merging this pull request may close these issues.

1 participant