Skip to content

refactor: nav to server component; add loading states#15642

Merged
corwintines merged 18 commits into
devfrom
nav-ssr-loading
Jun 25, 2025
Merged

refactor: nav to server component; add loading states#15642
corwintines merged 18 commits into
devfrom
nav-ssr-loading

Conversation

@wackerow
Copy link
Copy Markdown
Member

@wackerow wackerow commented Jun 9, 2025

Description

  • Updates primary Nav bar to more granularly use "use client" components only where needed, migrated rest to server page component.
  • Create Nav/Client/index.ts for client-side navigation logic.
  • Lazy loads potentially-blocking components with dynamic, with loading placeholder components
  • Cleans up Nav bar structure; Reduces scope of SearchProvider (renamed from Search) to only component that require it.

wackerow added 4 commits June 7, 2025 20:03
feat: add nav menu loading skeletons
Unwraps unrelated components from SearchProvider allowing them to load immediately; removes those skeletons from loader; intl: extracts aria labels
@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 9, 2025

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit 7ab5398
🔍 Latest deploy log https://app.netlify.com/projects/ethereumorg/deploys/6859e9b404866f000846998b
😎 Deploy Preview https://deploy-preview-15642--ethereumorg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
7 paths audited
Performance: 50 (🔴 down 8 from production)
Accessibility: 96 (🟢 up 2 from production)
Best Practices: 91 (🔴 down 8 from production)
SEO: 99 (no change from production)
PWA: 59 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added content 🖋️ This involves copy additions or edits tooling 🔧 Changes related to tooling of the project translation 🌍 This is related to our Translation Program labels Jun 9, 2025
@corwintines corwintines self-assigned this Jun 10, 2025
Comment thread src/components/Nav/useThemeToggle.ts Outdated
wackerow added 4 commits June 13, 2025 16:54
opacity-5 dark:opacty-60, using animate-pulse-light (animates to/from 20% opacity)
use default ui/skeleton opacity
Copy link
Copy Markdown
Member

@pettinarip pettinarip left a comment

Choose a reason for hiding this comment

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

@wackerow great job! looks fantastic 👍🏼

@nloureiro @konopkja would like to get the designers' input on the loading skeletons for the menu objects and see if we are all aligned. Dropping a short video demoing what it looks like on slow connections.

record-06-16-2025-14.06.54.mp4

Comment thread src/layouts/BaseLayout.tsx Outdated
Comment thread src/components/Nav/Client/index.tsx Outdated
)}

{desktopScreen && (
<LanguagePicker>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We would need to lazy load the lang picker and the search button as well since it will be not interactive in slow connections while loading.

Basically we need to lazy load all the nav components (except the logo link) IMO since they all need js for execution.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah good call... this displays it quicker, but it's not interactive immediately which hurts us. Will patch

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

From trying this out though, we're already lazy loading the SearchProvider component though, which loads an interactive search component when ready.

The theme toggle as well, seems to be interactive immediately, so I think we're good there.

The LanguagePicker though will be visible without interactivity when it first loads, so I'll lazy load that as well.

Comment thread src/components/Nav/Client/index.tsx
Comment thread src/components/Nav/index.tsx Outdated
@corwintines corwintines merged commit 29e49c5 into dev Jun 25, 2025
6 checks passed
@corwintines corwintines deleted the nav-ssr-loading branch June 25, 2025 14:15
Copy link
Copy Markdown
Member

@pettinarip pettinarip left a comment

Choose a reason for hiding this comment

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

@wackerow great job, merging.

There are still two buttons above the fold that should be also covered: the color mode toggle and the morpher button. Both should be delayed.

</SearchProvider>

{desktopScreen && (
<Button
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we also need to display a skeleton for this button. Currently, the button is no responsive when clicked in pre-load time, affecting INP and FID. We can tackle this is a separate PR.

@pettinarip
Copy link
Copy Markdown
Member

lol, @corwintines we were in sync with this PR haha

This was referenced Jun 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

content 🖋️ This involves copy additions or edits tooling 🔧 Changes related to tooling of the project translation 🌍 This is related to our Translation Program

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants