Skip to content

feat(nav): Add initial SecondaryNav component #83687

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

Merged
merged 4 commits into from
Jan 23, 2025

Conversation

malwilley
Copy link
Member

@malwilley malwilley commented Jan 17, 2025

Ref #84018

Adds the visual components and a story that will be added to as more work is done

CleanShot 2025-01-17 at 15 12 30

@malwilley malwilley requested a review from a team January 17, 2025 23:14
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jan 17, 2025
Comment on lines 7 to 16
const ref = useRef<HTMLDivElement>(null);
const {setSecondaryNavEl} = useNavContext();

useEffect(() => {
if (ref.current) {
setSecondaryNavEl(ref.current);
}
}, [ref, setSecondaryNavEl]);

return <SecondarySidebarWrapper ref={ref} />;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think refs trigger useEffects. You might be seeing the useMemo from the context trigger the useEffect at the right time. This will also set it to null on unmount

Suggested change
const ref = useRef<HTMLDivElement>(null);
const {setSecondaryNavEl} = useNavContext();
useEffect(() => {
if (ref.current) {
setSecondaryNavEl(ref.current);
}
}, [ref, setSecondaryNavEl]);
return <SecondarySidebarWrapper ref={ref} />;
const {setSecondaryNavEl} = useNavContext();
return <SecondarySidebarWrapper ref={setSecondaryNavEl} />;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good call, this is much better

Comment on lines +31 to +33
SecondaryNav.Body = function SecondaryNavBody({children}: {children: ReactNode}) {
return <Body>{children}</Body>;
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding functions to a function object seems cursed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's javascript for ya

Copy link

codecov bot commented Jan 18, 2025

Bundle Report

Changes will increase total bundle size by 8.1kB (0.02%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
app-webpack-bundle-array-push 33.36MB 8.1kB (0.02%) ⬆️

@malwilley malwilley requested review from scttcper and a team January 21, 2025 19:01
@malwilley malwilley merged commit 85e4a0c into master Jan 23, 2025
42 checks passed
@malwilley malwilley deleted the malwilley/feat/nav-comp-start branch January 23, 2025 20:58
@github-actions github-actions bot locked and limited conversation to collaborators Feb 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants