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

[Bug]: Statically defined loader isn't running in parallel with the lazy function #10275

Closed
erism opened this issue Mar 28, 2023 · 2 comments
Closed
Labels

Comments

@erism
Copy link

erism commented Mar 28, 2023

What version of React Router are you using?

6.9.0

Steps to Reproduce

Crate a route with lazy and loader definition.
Add delays and console logs to both lazy and loader definitions in order to inspect running order.

Example codesandbox

Expected Behavior

Loader function should run in parallel with lazy according to the docs:
https://reactrouter.com/en/main/route/lazy#statically-defined-properties

According to the example codesandbox, running order should be (visible on console):
-Lazy import begin
-loader begin
-loader end
-Lazy import end

Actual Behavior

Loader function starts after lazy function finishes. Running order is:
-Lazy import begin
-Lazy import end
-loader begin
-loader end

@erism erism added the bug label Mar 28, 2023
@brophdawg11
Copy link
Contributor

brophdawg11 commented Mar 29, 2023

Ah this is actually the same root cause as #10194 and was fixed by #10201. That's available in 6.10.0-pre.2 currently and should be out in a stable 6.10.0 shortly.

As a note, it's only an issue for lazy routes on initial load. They do run in parallel on subsequent client-side navigations.

@brophdawg11 brophdawg11 self-assigned this Mar 29, 2023
@brophdawg11 brophdawg11 added the awaiting release This issue have been fixed and will be released soon label Mar 29, 2023
@brophdawg11
Copy link
Contributor

I think this should be resolved in 6.10.0 now

@brophdawg11 brophdawg11 removed the awaiting release This issue have been fixed and will be released soon label Mar 29, 2023
@brophdawg11 brophdawg11 removed their assignment Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants