Skip to content
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

Fix Remix redirect on bounce #473

Merged
merged 2 commits into from
Oct 24, 2023
Merged

Fix Remix redirect on bounce #473

merged 2 commits into from
Oct 24, 2023

Conversation

btomaj
Copy link
Contributor

@btomaj btomaj commented Oct 22, 2023

WHY are these changes introduced?

Remix v2 changed some instances of ErrorResponse to ErrorResponseImpl, breaking const { redirect } = authenticate.admin(request); redirects.

WHAT is this pull request doing?

This change allows redirects to work on both ErrorResponse and ErrorResponseImpl.

Type of change

  • Patch: Bug (non-breaking change which fixes an issue)
  • Minor: New feature (non-breaking change which adds functionality)
  • Major: Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have used yarn changeset to create a draft changelog entry (do NOT update the CHANGELOG.md files manually)
  • I have added/updated tests for this change
  • I have documented new APIs/updated the documentation for modified APIs (for public APIs)

@btomaj btomaj requested a review from a team as a code owner October 22, 2023 10:32
@btomaj
Copy link
Contributor Author

btomaj commented Oct 22, 2023

@byrichardpowell FYI

Copy link
Contributor

@paulomarg paulomarg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems good to me! Could you please run yarn changeset to add a changeset so we can merge it? This should just be a patch change, and I'd recommend this message:

Fixed the errorBoundary to work with new cases in Remix v2.

@btomaj
Copy link
Contributor Author

btomaj commented Oct 23, 2023

@paulomarg I asked the Remix team about the difference between ErrorResponse and ErrorResponseImpl, and I was told that ErrorResponse is intended for stdout whereas ErrorResponseImpl is internal (meaning not for stdout). I'm not familiar enough with the inner workings of this codebase, so before we merge this in, I wanted to ask if this change from the Remix team requires a bigger change to error handling?

@btomaj
Copy link
Contributor Author

btomaj commented Oct 24, 2023

Added changeset and tests. If I have understood the code correctly, I believe ErrorResponse should be removed unless kept for backward compatibility with earlier versions of Remix, but I will leave that up to you.

@paulomarg
Copy link
Contributor

@paulomarg I asked the Remix team about the difference between ErrorResponse and ErrorResponseImpl, and I was told that ErrorResponse is intended for stdout whereas ErrorResponseImpl is internal (meaning not for stdout). I'm not familiar enough with the inner workings of this codebase, so before we merge this in, I wanted to ask if this change from the Remix team requires a bigger change to error handling?

Thanks for chasing it down. As far as this codebase goes, this is the only place where we do this. We're trying to find a better way to handle the headers in these cases, so hopefully this code will be replaced by a "proper" check in the future.

Let's also leave the previous implementation around, as you said it helps with compatibility and shouldn't cause any problems in v2 if ErrorResponse never reaches this code.

@paulomarg paulomarg merged commit edb9956 into Shopify:main Oct 24, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants