-
-
Notifications
You must be signed in to change notification settings - Fork 875
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
fix(react-router): lazyRouteComponent reload guard key fallsback to importer's import.meta.url on Safari #3450
Open
Sheraff
wants to merge
4
commits into
TanStack:main
Choose a base branch
from
Sheraff:lazy-component-safari-meta-name
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
View your CI Pipeline Execution ↗ for commit 5ffcb02.
☁️ Nx Cloud last updated this comment at |
More templates
@tanstack/arktype-adapter
@tanstack/create-start
@tanstack/create-router
@tanstack/directive-functions-plugin
@tanstack/eslint-plugin-router
@tanstack/history
@tanstack/react-cross-context
@tanstack/react-router
@tanstack/react-router-with-query
@tanstack/router-core
@tanstack/router-cli
@tanstack/router-devtools
@tanstack/router-generator
@tanstack/router-plugin
@tanstack/router-utils
@tanstack/router-vite-plugin
@tanstack/server-functions-plugin
@tanstack/start
@tanstack/start-api-routes
@tanstack/start-client
@tanstack/start-config
@tanstack/start-plugin
@tanstack/start-router-manifest
@tanstack/start-server
@tanstack/start-server-functions-client
@tanstack/start-server-functions-fetcher
@tanstack/start-server-functions-handler
@tanstack/start-server-functions-server
@tanstack/valibot-adapter
@tanstack/start-server-functions-ssr
@tanstack/virtual-file-routes
@tanstack/zod-adapter
commit: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #3327
This PR might be easier to review as commit-by-commit (because there are many changes in generated files
packages/router-plugin/tests/code-splitter/snapshots/...
).e2e/react-router/basic-file-based-code-splitting
Add an E2E playwright spec for validating the reload behavior of pages where a lazy import fails to load
packages/react-router/src/lazyRouteComponent.tsx
Accept a 4th parameter to provide a unique key to the sessionStorage entry used as a reload guard on a failed lazy load
packages/router-generator/src/generator.ts
andpackages/router-plugin/src/core/code-splitter/compilers.ts
Provide 4th parameter to
lazyRouteComponent
calls asimport.meta.url
. This is native in browsers, so should be "bundler independant" (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta).Note
The playwright spec added by this PR tests a behavior that might be browser-specific. However, the E2E tests run on chromium only. Maybe it might be worth it to enable multiple "projects" in playwright?
See implementation:
router/packages/react-router/src/lazyRouteComponent.tsx
Lines 10 to 20 in adcdde4
In a future PR, it might be a good idea to apply the same (or similar) behavior on import fail to the
lazyFn
since it's used in a way that feels similar tolazyRouteComponent
, but has no error handling.router/packages/react-router/src/router.ts
Lines 3060 to 3073 in adcdde4