Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

[BUG] profile page is rendering twice #9368

Closed
sital002 opened this issue Oct 5, 2023 · 11 comments · Fixed by #9380
Closed

[BUG] profile page is rendering twice #9368

sital002 opened this issue Oct 5, 2023 · 11 comments · Fixed by #9380
Assignees
Labels
💻 aspect: code undefined 🛠 goal: fix undefined 🔢 points: 3 undefined 🏁 status: ready for dev You can asked for this issue to be assigned (if not already assigned)

Comments

@sital002
Copy link
Member

sital002 commented Oct 5, 2023

Description

Steps to reproduce:
Go to https://www.biodrop.io/eddiejaoude
When going from the links tab to other tabs the page renders twice. You can see a flicker when you change the tab from links to other tabs.

Screenshots

No response

Do you want to work on this issue?

Yes

Additional information

No response

@sital002 sital002 added 🚦 status: awaiting triage Waiting for maintainers to verify (please do not start work on this yet) 🛠 goal: fix undefined labels Oct 5, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2023

To reduce notifications, issues are locked until they are 🏁 status: ready for dev You can asked for this issue to be assigned (if not already assigned) and to be assigned. You can learn more in our contributing guide https://github.com/EddieHubCommunity/BioDrop/blob/main/CONTRIBUTING.md

@github-actions github-actions bot locked and limited conversation to collaborators Oct 5, 2023
@EddieHubCommunity EddieHubCommunity unlocked this conversation Oct 5, 2023
@eddiejaoude
Copy link
Member

Thanks for raising the issue @sital002 - when navigating between the tabs we add to the browser history using the built-in router but this causes a reload. I think we might be able to use React Memo here?

@Abhishek-90
Copy link
Contributor

Abhishek-90 commented Oct 6, 2023

@eddiejaoude correct me, but are you talking about wrapping the page entirely inside useMemo hook which returns the page only when there is a change in the tab url parameter?

@eddiejaoude
Copy link
Member

I am not sure, it is a idea, I think some research needs to be done

@Abhishek-90
Copy link
Contributor

@eddiejaoude if it is okay, I would like to take it up and being some research right away.

@eddiejaoude
Copy link
Member

Please do some research and make suggestions on how to solve before we assign, this will avoid blocking the issue

@sital002
Copy link
Member Author

sital002 commented Oct 6, 2023

I have already implemented similar feature on repos page https://www.biodrop.io/repos where the filter options is updated on the browser url we could do the same for this one as well.
Can you assign this to me

@eddiejaoude
Copy link
Member

Sure @sital002 but could you also please share the solution you took here so others can learn from it

@eddiejaoude eddiejaoude added 💻 aspect: code undefined 🔢 points: 3 undefined 🏁 status: ready for dev You can asked for this issue to be assigned (if not already assigned) and removed 🚦 status: awaiting triage Waiting for maintainers to verify (please do not start work on this yet) labels Oct 6, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2023

The issue has been unlocked and is now ready for dev. If you would like to work on this issue, you can comment to have it assigned to you. You can learn more in our contributing guide https://github.com/EddieHubCommunity/BioDrop/blob/main/CONTRIBUTING.md

@sital002
Copy link
Member Author

sital002 commented Oct 6, 2023

For the repos page, I added the query params to the URL which will rerender the page and rerun the getServerSideProps, and fetch the data from the database but in the profile page when we add the query param tab to the URL the getServerSideProps method is rerunning which is causing the page to re-render multiple times. We can stop the re-running getServerSideProps by adding the property shallow: true on the router.push() method which will prevent running getServerSideProps here is docs for shallow:true property https://nextjs.org/docs/pages/building-your-application/routing/linking-and-navigating#shallow-routing.

@eddiejaoude
Copy link
Member

Sounds good 👍 We have a similar issue here I think? #9248 (review)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
💻 aspect: code undefined 🛠 goal: fix undefined 🔢 points: 3 undefined 🏁 status: ready for dev You can asked for this issue to be assigned (if not already assigned)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants