Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hoverling links with defaultPreload: "intent" causes 2 rerenders of tree, one with missing current route context #1624

Closed
maksymskuibida opened this issue May 18, 2024 · 5 comments
Labels
information needed Further information is requested

Comments

@maksymskuibida
Copy link

Describe the bug

I have defaultPreload: "intent". I have layout route which returns some additional context from beforeLoad. I have some navigation links and when I hover it, in layout route Component I have const { someProp } = Route.useRouteContext(). When I hover any link, my layout route rerenders twice and on first rerender I am getting context without someProp returned from this layout route. I am getting context, including root and upper layout routes context, but not this route context.

It was introduced in 1.32.16

Your Example Website or App

I had small time to check fix for issue with undefined context after redirect and noticed this new issue, I will be able to make reproduction tomorrow, if it will be needed

Steps to Reproduce the Bug or Issue

  1. Return something from beforeLoad
  2. call hook Route.useRouteContext() in this route Component
  3. Hover any other link with defaultPreload: "intent"

Expected behavior

When I hover link, app has not to rerender at all

Screenshots or Videos

No response

Platform

Version: 1.32.16

Additional context

No response

@SeanCassiere
Copy link
Contributor

Need a minimal reproduction with the steps required to trigger the behavior you described.

@SeanCassiere SeanCassiere added the information needed Further information is requested label May 18, 2024
@SeanCassiere
Copy link
Contributor

@maksymskuibida any luck with a reproduction? please try it with 1.33.6.

@maksymskuibida
Copy link
Author

@maksymskuibida any luck with a reproduction? please try it with 1.33.6.

Hello, I'll try. I am sorry, had no time for this. Hopefully I will do it today, if 1.33.6 does not work

@maksymskuibida
Copy link
Author

@SeanCassiere Only now I had a change to test it. Updating to 1.33.6 fixed this issue. But also it broke throw redirect again.

In my case it happens if I reloads the page with resetting cache (cmd + shift + R) and then do logout, which causes throw redirect in _authorised route beforeLoad. It does not happen on login, where I also do "throw redirect" in login beforeLoad route. I don't know why it happens only on logout.

I will try to create reproduction, but I am busy right now, have a lot of work to do and I don't know when I will have time to do it.

@maksymskuibida
Copy link
Author

I have just updated to the latest version at it is fixed now. I didn't see in release notes what release could fix it, but it is ok now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
information needed Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants