TanStackT
TanStack7mo ago
4 replies
nursing-lime

set defaultViewTransition to false when search params are updating.

I'm doing a search feature, but when I trigger the navigate (with new search params so), there is always the view transition (so my input is doing opacity 0 to 1 on each key..).

I tried this but doesn't work :

defaultViewTransition: {
  types: ({ fromLocation, toLocation, pathChanged }) => {
    let direction = 'none'

    if (fromLocation && pathChanged) {
      const fromIndex = fromLocation.state.__TSR_index
      const toIndex = toLocation.state.__TSR_index

      direction = fromIndex > toIndex ? 'right' : 'left'
    }

    return [`slide-${direction}`]
  }
}
Was this page helpful?