Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/serious-chairs-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"react-router": patch
---

Remove `<Link prefetch>` warning which suffers from false positives in a lazy route discovery world
1 change: 0 additions & 1 deletion packages/react-router/lib/dom/ssr/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ export function PrefetchPageLinks({
);

if (!matches) {
console.warn(`Tried to prefetch ${page} but no routes matched.`);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine to remove entirely as if the route doesn't truly exist it'll 404 anyway so there's no real benefit in "hey I cant prefetch anything for this link that won't work anyway".

If we really wanted to keep it, then I think we would need to add some verbiage around the fact that it might print once prior to the route being discovered but then work after discovery completes, which is gross.

return null;
}

Expand Down
Loading