-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
chore: refactor shell to individual files #16893
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Skipped Deployments
|
Hey there and thank you for opening this pull request! 👋🏼 We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted. Details:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to a hook that can live outside of shell
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same goes as above with its helper fuctions
Graphite Automations"Add consumer team as reviewer" took an action on this PR • (10/01/24)1 reviewer was added to this PR based on Keith Williams's automation. "Add foundation team as reviewer" took an action on this PR • (10/01/24)1 reviewer was added to this PR based on Keith Williams's automation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create a hook that boots intercom - no need for this to live directly in shell either. Means we can control when the "me" query is called much easier i the future as it was being called on every render
packages/features/shell/Shell.tsx
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow thats a lot less lines
return bannersHeight; | ||
}; | ||
|
||
const useBanners = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets just have one hook to get all banners and calculate the height
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great refactor @sean-brydon
Test Cases
- Desktop view ✅
- Reduced side bar ✅
- Mobile nav ❌
- Unauthed redirect to login page ✅
- Onboarding trigger ✅
Blocking
- If we're refactoring right now can we abstract some of the hooks logic so we can prepare for the app router migration? If it's too big then I'm ok having this in a follow up PR. FYI @hbjORbj
- In the mobile nav container when clicking
More
I get this error
Non-blocking
- Have you considered using
useCallback
at all to help with preventing rerenders? I'm also ok with having it in a follow up PR
onInteractOutside={() => { | ||
setMenuOpen(false); | ||
}} | ||
className="min-w-56 hariom group overflow-hidden rounded-md"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did @hariombalhara sneak in here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats a great question lol
100%! As i mentioned in the PR description - i've not made any perf improvements here. Just making the component more manageable!
I don't understand what you mean here? I've tried to abstract all hooks that were present in the shell
|
E2E results are ready! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Navigation is now working as expected.
In terms of my abstracting hooks logic comment. We can't call hooks in server components so ideally I would have liked to see the logic inside of the hooks to be abstracted. Although looking through it some more I realize it would be too big for this PR so let's cross that bridge when we get there.
What does this PR do?
This PR is one of many that refactors the Shell component out of one file and into many sub components. This PR is just extracting with no performance improvements. They will happen in a follow up PR
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Checklist