Created
November 10, 2022 00:35
-
-
Save kiliman/6ecc2186d487baa248d65f79128f72f6 to your computer and use it in GitHub Desktop.
Patches for Remix to resolve issues with `index` route handling
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
diff --git a/node_modules/@remix-run/react/dist/esm/components.js b/node_modules/@remix-run/react/dist/esm/components.js | |
index e884e7b..56ddff4 100644 | |
--- a/node_modules/@remix-run/react/dist/esm/components.js | |
+++ b/node_modules/@remix-run/react/dist/esm/components.js | |
@@ -746,6 +746,7 @@ FormImpl.displayName = "FormImpl"; | |
*/ | |
function useFormAction(action, // TODO: Remove method param in v2 as it's no longer needed and is a breaking change | |
method = "get") { | |
+ let { manifest }= useRemixEntryContext() | |
let { | |
id | |
} = useRemixRouteContext(); | |
@@ -760,7 +761,7 @@ method = "get") { | |
search, | |
hash | |
} = resolvedPath; | |
- let isIndexRoute = id.endsWith("/index"); | |
+ let isIndexRoute = manifest.routes[id].index | |
if (action == null) { | |
search = location.search; |
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
diff --git a/node_modules/@remix-run/server-runtime/dist/server.js b/node_modules/@remix-run/server-runtime/dist/server.js | |
index 5ac2304..58e39f3 100644 | |
--- a/node_modules/@remix-run/server-runtime/dist/server.js | |
+++ b/node_modules/@remix-run/server-runtime/dist/server.js | |
@@ -503,7 +503,7 @@ function isIndexRequestUrl(url) { | |
function getRequestMatch(url, matches) { | |
let match = matches.slice(-1)[0]; | |
- if (isIndexRequestUrl(url) && match.route.id.endsWith("/index")) { | |
+ if (isIndexRequestUrl(url) && match.route.index) { | |
return match; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment