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

app shows 500 error page when switching page using shortcuts or browser buttons #1150

Open
rahultrivedi1800 opened this issue Aug 23, 2022 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@rahultrivedi1800
Copy link
Contributor

rahultrivedi1800 commented Aug 23, 2022

sr-2022-08-23_14.42.50.webm

Steps to reproduce:

  1. Open any post from the feed
  2. Go back to the feed by alt+left key (or shortcut key that you have set or browser back button)
  3. Again go back to the same post by alt+right key.
@rahultrivedi1800 rahultrivedi1800 added the bug Something isn't working label Aug 23, 2022
@rahultrivedi1800 rahultrivedi1800 self-assigned this Aug 23, 2022
@ashutosh1206
Copy link
Contributor

Happens on user profiles too:
https://user-images.githubusercontent.com/20791518/187151945-1009b0c1-4f8d-4456-b52b-9da8783de453.mov

@rahultrivedi180 on discord:

there are two points I found out.

  1. When we replace the url before page exit, it does not work as expected. So it will still go to the friendlyUrl page instead of realUrl page from home page .
  2. We don't have friendlyUrl page so it crashes the app.

refresh the browser history after switching pages (Home -> Post -> Home) to see what is happening. history behavior seems to be OK as per the history.replaceState documentation

@jackdishman
Copy link
Contributor

Brainstorming solutions that I see that could solve this issue:

  1. Create a /p/ route that fetches the post, forking layout from /post/cid but fetching the post from the friendly URL.
  2. Replace history state before route leave to /post/ URL
  3. Add a watcher to route and if it's a /p/ route, reload page and stop vue-router

@rahultrivedi1800
Copy link
Contributor Author

Create a /p/ route that fetches the post, forking layout from /post/cid but fetching the post from the friendly URL.

So the user will first come to the /p/ route (with friendly URL as a parameter) whenever they visit the post. Am I right?

@jackdishman
Copy link
Contributor

Yes, create a /p/ route and then either refresh the page or fetch the post from the friendly URL

@rahultrivedi1800
Copy link
Contributor Author

Not sure if it is good to fetch the post from a friendly URL. Because this way, we will have to rely on the capsule server to send us IPFS CID whenever the user tries to open the post directly from the shared link instead of the feed. If somehow server does not respond back, user may face an error page.

@jackdishman
Copy link
Contributor

I agree, that leaves us with options 2 and 3:

Replace history state before route leave to /post/ URL
or
Add a watcher to route and if it's a /p/ route, reload page and stop vue-router

@chrispanag
Copy link
Contributor

If it's a /p/ route, we can fetch the IPFS cid, from capsule-server (this would require an extra GET route on the shareable link, that gives the cid of a given post id). With this CID, capsule-vue can then fetch the correct post.

@rahultrivedi1800
Copy link
Contributor Author

rahultrivedi1800 commented Aug 30, 2022

If it's a /p/ route, we can fetch the IPFS cid, from capsule-server (this would require an extra GET route on the shareable link, that gives the cid of a given post id). With this CID, capsule-vue can then fetch the correct post.

do you mean we should have two different post reader pages? /p/ and /post?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants