-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Updates to static handler for Remix integration #9511
Conversation
🦋 Changeset detectedLatest commit: 51f453a The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -458,7 +458,7 @@ describe("NavLink using a data router", () => { | |||
fireEvent.click(screen.getByText("Link to Bar")); | |||
expect(screen.getByText("Link to Bar").className).toBe("pending"); | |||
|
|||
dfd.resolve(); | |||
dfd.resolve(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests used to return undefined
, so make them return null
now
@@ -11214,7 +11302,7 @@ describe("a router", () => { | |||
); | |||
}); | |||
|
|||
it("should handle not found routes with a 404 Response", async () => { | |||
describe("Errors with Status Codes", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
View this section with whitespace hidden, but now instead of returning responses we return a new ErrorWithStatus
instance and we align the error messages with what Remix uses
loaderHeaders: {}, | ||
actionHeaders: {}, | ||
}; | ||
throw result.error; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to put this into a context object, just throw it directly now
* Updates to unstable staticHandler logic for Remix integration * Add changeset * bump bundle * Remove ErrorWithStatus in favor of extended ErrorResponse * update * Update changelog
Updates to
createStaticHandler
to streamline and make internal router-thrownErrorResponse
's consistent for easier integration into Remix. This also fixes a bug where aloader
/action
could previously returnundefined
which causes subsequent issues with hydration and revalidation, so we now throw an error to theerrorElement
if this happens. Users can returnnull
if they don't need to return any data.Todo: