Refactor Links.tsx to use react islands - #3841
Merged
Merged
Conversation
OllysCoding
requested review from
DavidLawes,
jlieb10 and
lucymonie
as code owners
January 18, 2022 12:58
|
Size Change: -14.6 kB (-1%) Total Size: 2.59 MB
ℹ️ View Unchanged
|
oliverlloyd
approved these changes
Jan 18, 2022
oliverlloyd
left a comment
Contributor
There was a problem hiding this comment.
A minor comment on what to do if there's an error but not a blocker
Contributor
Author
Contributor
|
part of #3629 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
Refactors Links.tsx to use react islands
To achieve this I had to move the previously global state
userIdto within the component. We only want to request the user profile on the client, creating theMyAccountcomponent allowed us to ensure it only requests the profile there.I also generally refactored the component around how it hydrates. We can do this because now that this react component renders as it's own island, it's no longer affecting renders for anything else.
Inspiration for this credited to #3747 (thanks @oliverlloyd)
Why?
This helps with our general goal of migrating away from and deleting App.tsx, but also unblocks #3832, which is having a hydration problem which is solved by islands.
Testing
I've tested this locally, however since logging in does not work locally, we should also test on CODE to ensure functionality