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

404 is shown for 1 second before matching client paths ( /blog is one of the example) #5391

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Assad-Ashraf
Copy link

@Assad-Ashraf Assad-Ashraf commented Dec 21, 2022

Greetings

Hi React Team,

This is my first time open source contribution. I have followed the React Guidelines too.

Issue

When we hit the blogs Link from [Beta] docs, the 404 page is shown for a second and then actual content is got through graphQl Query and is displayed.

Bad UX

It's not naive to say that it creates a bad UX. I myself ( while i was on slow internet ), thought that docs server is down and moved away from website twice.

Solution for Gatsby

I have been working on this and found out that this thing was fixed in Gastby new versions, and there is an implemenation/work around to fix this into previous versions ( that react docs are using). I have managed to fix it and am creating this PR.

Testing

Please do let me know if there are further changes required in this PR. I have tested it and it's working fine. :)

@github-actions
Copy link

github-actions bot commented Dec 21, 2022

Size Changes%0A
%0A%0A## 📦 Next.js Bundle Analysis%0A%0AThis analysis was generated by the next.js bundle analysis action 🤖%0A%0AThis PR introduced no changes to the javascript bundle 🙌%0A%0A

@Assad-Ashraf Assad-Ashraf reopened this Dec 21, 2022
@Assad-Ashraf Assad-Ashraf changed the title 404 is shown for 1 second before matching client paths 404 is shown for 1 second before matching client paths ( /blog is one of the example) Dec 21, 2022
@gaearon
Copy link
Member

gaearon commented Jan 2, 2023

This doesn't look like a good fix to me. It tries to work around the problem by showing different content on the client on the server (which is not supported by React). What is the real canonical way to solve this?

@Assad-Ashraf
Copy link
Author

Assad-Ashraf commented Jan 2, 2023

@gaearon In 2018, Gatsby team fixed this problem in their package and they started supporting SSR stuff in V3. You are using a version lesser then v3. There is no actual way to resolve it other then updating the package itself. I had it updated and i think change of this level will not be accepted in this regard ( can also cause conflicts ). So i came up with this solution that i have implemented. I can also create a PR after updating the version of Gatsby to v3 if you want. ATM this is the only possibility to fix it. @gaearon What do you think about this? And please do mention why it is not a good solution ( just for the sake of getting the ideas you have in your mind )?

@Assad-Ashraf
Copy link
Author

Assad-Ashraf commented Jan 5, 2023

@gaearon I have seen there is a route to redirect /blog to /blog/all.html with all the Blogs listing, this can also be done here. Furthermore i have looked into updating the Gatsby to v3, the amount of work on it is drastic and has many conflicts with other packages. I think we should redirect the /blog to /blog/all.html or accept the work around done here because it is also recommended by Gatsby team if there is drastic change in codebase for version upgrade from v2 to v3. etc. What do you think ?

Screenshot from 2023-01-05 17-39-33

@Assad-Ashraf
Copy link
Author

Assad-Ashraf commented Jan 30, 2023

@gaearon Thanks for implementing the idea i gave here. Now blogs are working fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants