router icon indicating copy to clipboard operation
router copied to clipboard

Weird pendingMs behavior

Open tannerlinsley opened this issue 2 years ago • 2 comments

Discussed in https://github.com/TanStack/react-location/discussions/243

Originally posted by GabriFila March 17, 2022 Hi everyone, loving react-location, I use it for its url-search-related features. I added code-route-splitting. I wanted to add/play with the pendingMs and pendingMinMs settings.

I've prepared a sandbox with an example https://codesandbox.io/s/busy-frog-lr9x4p?file=/src/App.tsx

It is a simple application with 3 dynamically loaded routes:

  • homepage on /
  • route A on /a
  • route B on /b

I set these defaults in my router:

  • defaultPendingMinMs=100000
  • defaultPendingMs=1
  • defaultPendingElement=(a fullscreen red div)

If I understand correctly react-location, this settings should tell the router to show the pending element after 1ms (so almost always) of waiting and show it for 100s, then show the route.

But this behavior doesn't show, meaning that when I change a route, the outlet is blank for a split second (or more if I slow the network through devtools) and then it renders.

Could you please explain what I am missing here?

Thank you!

tannerlinsley avatar Mar 17 '22 17:03 tannerlinsley

@GabriFila, this issue is fixed in c4adf1f4841a0dd5999467a5594f39d1ce3a3733. It should be released within a few minutes.

tannerlinsley avatar Mar 17 '22 18:03 tannerlinsley

It works now!

Thank you very much for the quick fix!

Loving the TanStack 😍

GabriFila avatar Mar 18 '22 08:03 GabriFila