Created
December 8, 2021 16:41
-
-
Save kiliman/c1e1dc34324a500f0cffd1fef4d87ad4 to your computer and use it in GitHub Desktop.
PATCH to add request and context to Remix CatchBoundary
This file contains hidden or 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/server.js b/node_modules/@remix-run/server-runtime/server.js | |
index eef3403..d483581 100644 | |
--- a/node_modules/@remix-run/server-runtime/server.js | |
+++ b/node_modules/@remix-run/server-runtime/server.js | |
@@ -226,7 +226,9 @@ async function handleDocumentRequest(request, loadContext, build, platform, rout | |
componentDidCatchEmulator.catch = { | |
status: requestState === "no-match" ? 404 : 405, | |
statusText: requestState === "no-match" ? "Not Found" : "Method Not Allowed", | |
- data: null | |
+ data: null, | |
+ request: { method: request.method, url: request.url }, | |
+ context: loadContext, | |
}; | |
} else if (isActionRequest(request)) { | |
let actionMatch = matches[matches.length - 1]; | |
@@ -263,7 +265,9 @@ async function handleDocumentRequest(request, loadContext, build, platform, rout | |
componentDidCatchEmulator.catch = { | |
status: actionResponse.status, | |
statusText: actionResponse.statusText, | |
- data: await data.extractData(actionResponse.clone()) | |
+ data: await data.extractData(actionResponse.clone()), | |
+ request: { method: request.method, url: request.url }, | |
+ context: loadContext, | |
}; | |
} // If we did not match a route, there is no need to call any loaders | |
@@ -345,7 +349,9 @@ async function handleDocumentRequest(request, loadContext, build, platform, rout | |
componentDidCatchEmulator.catch = { | |
status: response.status, | |
statusText: response.statusText, | |
- data: await data.extractData(response.clone()) | |
+ data: await data.extractData(response.clone()), | |
+ request: { method: request.method, url: request.url }, | |
+ context: loadContext, | |
}; | |
routeLoaderResults[index] = responses.json(null, { | |
status: response.status |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment