Skip to content

feat: prep data-strategy for RSC re-use #13304

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/data-strategy-reuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@react-router/dev": patch
"react-router": patch
---

prep data-strategy for RSC re-use
1 change: 1 addition & 0 deletions integration/helpers/create-fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ export async function createAppFixture(fixture: Fixture, mode?: ServerMode) {
);
app.get("*", (req, res, next) => {
let dir = path.join(fixture.projectDir, "build", "client");
// TODO: Update this to be configurable somehow for RSC
let file = req.path.endsWith(".data")
? req.path
: req.path + "/index.html";
Expand Down
1 change: 1 addition & 0 deletions integration/helpers/playwright-fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ export class PlaywrightFixture {
* loaders were called (or not).
*/
collectSingleFetchResponses() {
// TODO: Update this to be configurable somehow for RSC
return this.collectResponses((url) => url.pathname.endsWith(".data"));
}

Expand Down
1 change: 1 addition & 0 deletions packages/react-router-dev/vite/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2726,6 +2726,7 @@ async function prerenderData(
viteConfig: Vite.ResolvedConfig,
requestInit: RequestInit
) {
// TODO: Update this to be configurable somehow for RSC
let normalizedPath = `${reactRouterConfig.basename}${
prerenderPath === "/"
? "/_root.data"
Expand Down
3 changes: 2 additions & 1 deletion packages/react-router/lib/dom/ssr/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,8 @@ function PrefetchPageLinksImpl({
return [];
}

let url = singleFetchUrl(page, basename);
// TODO: Update extension to be configurable for RSC
let url = singleFetchUrl(page, basename, "data");
// When one or more routes have opted out, we add a _routes param to
// limit the loaders to those that have a server loader and did not
// opt out
Expand Down
Loading
Loading