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

feat(nav): Add initial SecondaryNav component #83687

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

malwilley
Copy link
Member

@malwilley malwilley commented Jan 17, 2025

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 223.25kB (0.71%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
app-webpack-bundle-array-push 31.52MB 223.25kB (0.71%) ⬆️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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