Skip to content

Make easier to use View Transitions with shallow routing #11759

Description

@hazycora

Describe the problem

sveltekit's onNavigate doesn't run for shallow routing as these aren't truly navigations. This means if you want to use a view transition for a shallow route you need to modify the code wherever pushState/replaceState is ran using the lower level tick function. This is a bit messy.

Describe the proposed solution

maybe onNavigate can optionally support shallow routing as well with an optional boolean property before the callback?

// I want my callback to run for shallow routing
onNavigate(true, async () => {
	// boilerplate view transition code
})
// the default behaviour would still be possible by not providing this argument or by specifying false

Alternatives considered

A separate function, onShallowNavigate or similar.

Importance

nice to have

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions