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

Handle redirects isomorphically #5538

Merged
merged 5 commits into from
Sep 21, 2020
Merged

Handle redirects isomorphically #5538

merged 5 commits into from
Sep 21, 2020

Conversation

jamieparkinson
Copy link
Contributor

Redirects were not being followed when clicking a link (ie they required a refresh / getInitialProps) - this should fix that.

Apologies for the weird steps to reproduce but this is how I found it and I can't work out a simpler way:

  • Do an images search for 'rats'
  • Click the 3rd result, which says 'Tord Boyaux'
  • Click on 'More about this work' - get a 500
  • Refresh the page - redirect.

note: I know the link to the image is still broken, that's a pipeline issue that I'll take a look at next

The fetch API is quite strange in this respect, and whatever next gives us on the server doesn't appear to follow the spec. See:

Copy link
Contributor

@jamesgorrie jamesgorrie left a comment

Choose a reason for hiding this comment

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

Shouldn't this be exposed in the images API where we link to the merged work? Feels like exposing redirected URLs when we know they aren't is the wrong fix for this?

@jamieparkinson
Copy link
Contributor Author

Yeah, that's the pipeline issue I'm referring to - this PR fixes inconsistent behaviour between following links and "fresh" page loads, and I will fix the underlying issue with that specific example next.

Copy link
Contributor

@jamesgorrie jamesgorrie left a comment

Choose a reason for hiding this comment

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

Nice catch, nice fix!

@jamieparkinson jamieparkinson merged commit 84b5646 into master Sep 21, 2020
@jamieparkinson jamieparkinson deleted the redirect-handling branch September 21, 2020 14:05
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