Skip to content

Commit

Permalink
Add future.v3_relativeSplatPath flag (#8216)
Browse files Browse the repository at this point in the history
  • Loading branch information
brophdawg11 authored Dec 5, 2023
1 parent 2860de2 commit d76f3eb
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 7 deletions.
4 changes: 2 additions & 2 deletions integration/form-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ test.describe("Forms", () => {
await app.goto("/projects/blarg");
let html = await app.getHtml();
let el = getElement(html, `#${SPLAT_ROUTE_NO_ACTION}`);
expect(el.attr("action")).toMatch("/projects/blarg");
expect(el.attr("action")).toMatch("/projects");
});

test("no action resolves to URL including search params", async ({
Expand All @@ -931,7 +931,7 @@ test.describe("Forms", () => {
await app.goto("/projects/blarg?foo=bar");
let html = await app.getHtml();
let el = getElement(html, `#${SPLAT_ROUTE_NO_ACTION}`);
expect(el.attr("action")).toMatch("/projects/blarg?foo=bar");
expect(el.attr("action")).toMatch("/projects?foo=bar");
});

test("absolute action resolves relative to the root route", async ({
Expand Down
1 change: 1 addition & 0 deletions packages/remix-dev/__tests__/readConfig-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ describe("readConfig", () => {
"entryServerFilePath": Any<String>,
"future": {
"v3_fetcherPersist": false,
"v3_relativeSplatPath": false,
},
"mdx": undefined,
"postcss": true,
Expand Down
2 changes: 2 additions & 0 deletions packages/remix-dev/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type Dev = {

interface FutureConfig {
v3_fetcherPersist: boolean;
v3_relativeSplatPath: boolean;
}

type NodeBuiltinsPolyfillOptions = Pick<
Expand Down Expand Up @@ -581,6 +582,7 @@ export async function resolveConfig(
// typings this won't be necessary anymore.
let future: FutureConfig = {
v3_fetcherPersist: appConfig.future?.v3_fetcherPersist === true,
v3_relativeSplatPath: appConfig.future?.v3_relativeSplatPath === true,
};

if (appConfig.future) {
Expand Down
2 changes: 1 addition & 1 deletion packages/remix-dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@mdx-js/mdx": "^2.3.0",
"@npmcli/package-json": "^4.0.1",
"@remix-run/node": "2.3.1",
"@remix-run/router": "0.0.0-experimental-35fa15e5",
"@remix-run/router": "1.14.0-pre.0",
"@remix-run/server-runtime": "2.3.1",
"@types/mdx": "^2.0.5",
"@vanilla-extract/integration": "^6.2.0",
Expand Down
1 change: 1 addition & 0 deletions packages/remix-dev/vite/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ export const remixVitePlugin: RemixVitePlugin = (options = {}) => {
relativeAssetsBuildDirectory,
future: {
v3_fetcherPersist: options.future?.v3_fetcherPersist === true,
v3_relativeSplatPath: options.future?.v3_relativeSplatPath === true,
},
};
};
Expand Down
1 change: 1 addition & 0 deletions packages/remix-server-runtime/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface EntryContext {

export interface FutureConfig {
v3_fetcherPersist: boolean;
v3_relativeSplatPath: boolean;
}

export interface AssetsManifest {
Expand Down
2 changes: 1 addition & 1 deletion packages/remix-server-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"typings": "dist/index.d.ts",
"module": "dist/esm/index.js",
"dependencies": {
"@remix-run/router": "0.0.0-experimental-35fa15e5",
"@remix-run/router": "1.14.0-pre.0",
"@types/cookie": "^0.5.3",
"@web3-storage/multipart-parser": "^1.0.0",
"cookie": "^0.5.0",
Expand Down
6 changes: 5 additions & 1 deletion packages/remix-server-runtime/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ function derive(build: ServerBuild, mode?: string) {
let routes = createRoutes(build.routes);
let dataRoutes = createStaticHandlerDataRoutes(build.routes, build.future);
let serverMode = isServerMode(mode) ? mode : ServerMode.Production;
let staticHandler = createStaticHandler(dataRoutes);
let staticHandler = createStaticHandler(dataRoutes, {
future: {
v7_relativeSplatPath: build.future?.v3_relativeSplatPath,
},
});

let errorHandler =
build.entry.module.handleError ||
Expand Down
1 change: 1 addition & 0 deletions packages/remix-testing/create-remix-stub.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export function createRemixStub(
remixContextRef.current = {
future: {
v3_fetcherPersist: future?.v3_fetcherPersist === true,
v3_relativeSplatPath: future?.v3_relativeSplatPath === true,
},
manifest: {
routes: {},
Expand Down
4 changes: 2 additions & 2 deletions packages/remix-testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"dependencies": {
"@remix-run/node": "2.3.1",
"@remix-run/react": "2.3.1",
"@remix-run/router": "0.0.0-experimental-35fa15e5",
"react-router-dom": "0.0.0-experimental-35fa15e5"
"@remix-run/router": "1.14.0-pre.0",
"react-router-dom": "6.21.0-pre.0"
},
"devDependencies": {
"@types/node": "^18.17.1",
Expand Down

0 comments on commit d76f3eb

Please sign in to comment.