Skip to content

fix: remove Suspense from hero splash logo#786

Open
franklinjavier wants to merge 4 commits intoTanStack:mainfrom
franklinjavier:franklinjavier/hero-splash-cls
Open

fix: remove Suspense from hero splash logo#786
franklinjavier wants to merge 4 commits intoTanStack:mainfrom
franklinjavier:franklinjavier/hero-splash-cls

Conversation

@franklinjavier
Copy link

@franklinjavier franklinjavier commented Mar 26, 2026

Summary

  • Remove React.Suspense / LazyBrandContextMenu wrapper around the hero splash logo images
  • The Suspense fallback and loaded state rendered identical images but with different wrapper elements (<div> vs <BrandContextMenu>), causing layout shift on every page load
  • Images are now rendered directly — no lazy loading needed since they're the same in both states

Test plan

  • Hard refresh home page — splash logo should not shift/shake
  • Verify dark mode splash logo still displays correctly

Summary by CodeRabbit

  • Refactor
    • Removed deferred loading around the brand/context area so splash imagery is rendered directly, improving visual stability and eliminating initial flicker across light/dark themes.
  • Performance
    • Dark-theme splash image now lazy-loaded while light splash remains eager, reducing initial bandwidth and speeding perceived load.

The LazyBrandContextMenu Suspense boundary caused layout shift on page
load as the fallback div swapped to the loaded component. Since both
rendered the same images, replace with direct rendering.
@netlify
Copy link

netlify bot commented Mar 26, 2026

👷 Deploy request for tanstack pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit c35c8f4

@coderabbitai
Copy link

coderabbitai bot commented Mar 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3e711820-bd11-4141-ab6f-9e369aab4800

📥 Commits

Reviewing files that changed from the base of the PR and between cc6f863 and c35c8f4.

📒 Files selected for processing (1)
  • src/routes/index.tsx

📝 Walkthrough

Walkthrough

Removed the React.lazy/React.Suspense lazy-loading path for BrandContextMenu in src/routes/index.tsx; replaced it with a direct render of BrandContextMenu and inlined the two splash NetlifyImage elements, switching the dark splash to loading="lazy" while keeping the light splash eager.

Changes

Cohort / File(s) Summary
Route Rendering Update
src/routes/index.tsx
Removed React.lazy() dynamic import and surrounding React.Suspense plus its fallback UI. Directly render BrandContextMenu and inline both splash NetlifyImage elements; removed dark/light show/hide classes from the fallback and changed the dark splash image to loading="lazy" (light remains eager).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 I nibbled at suspense and found the seam,
Pushed lazy imports off and let splashes gleam.
One light wakes early, one dark takes its time,
A quiet patch of code—soft, small, sublime.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: remove Suspense from hero splash logo' directly and clearly summarizes the main change—removing React.Suspense wrapper from the hero splash logo component.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/routes/index.tsx`:
- Around line 131-143: The dark-theme NetlifyImage component (the second
NetlifyImage instance rendering splash-dark.png) is currently set to
loading="eager" and fetchPriority="high" even though it is hidden via CSS;
change that component's props to loading="lazy" and fetchPriority="auto" so the
hidden theme variant isn't fetched with high priority. Locate the NetlifyImage
with src="/images/logos/splash-dark.png" and update its loading and
fetchPriority attributes accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f74312aa-baaf-4890-8ebc-0fe30188b2ca

📥 Commits

Reviewing files that changed from the base of the PR and between e71479b and d2b760a.

📒 Files selected for processing (1)
  • src/routes/index.tsx

Only one splash image is visible per theme but both were fetched
eagerly. Keep only the light variant (works in both themes) to
avoid wasting bandwidth on a hidden image.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/routes/index.tsx`:
- Around line 124-133: Restore the dark-mode splash by adding the paired dark
image alongside the existing <NetlifyImage> (keep the current light src
"/images/logos/splash-light.png" and add a dark variant
"/images/logos/splash-dark.png"), using the same sizing/props but with
className="dark:hidden" on the light image and className="hidden dark:block" on
the dark image; lazy-load the dark variant (e.g., loading="lazy" / lower
fetchPriority) to avoid CLS while keeping the light image eager, and ensure both
images keep the same layout classes (w-[300px] pt-8 xl:pt-0 xl:w-[400px]
2xl:w-[500px]) so switching themes doesn't shift layout.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b8e7074d-6d5b-47e4-90b1-8055e39afbe9

📥 Commits

Reviewing files that changed from the base of the PR and between d2b760a and e06362b.

📒 Files selected for processing (1)
  • src/routes/index.tsx

Re-add the dark variant splash image with loading="lazy" so it
doesn't compete with the light image for bandwidth. Light image
stays eager for LCP; dark image loads on demand when dark mode
is active.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/routes/index.tsx`:
- Around line 124-142: Restore the BrandContextMenu wrapper around the hero
splash images so right‑click/context actions are preserved: replace the direct
NetlifyImage renderings inside the hero with <BrandContextMenu> wrapping the
NetlifyImage elements (the two NetlifyImage instances shown) and remove any
Suspense/React.lazy usage for BrandContextMenu so it renders synchronously;
ensure you import and use the BrandContextMenu component where NetlifyImage is
currently rendered and keep the image props (src, width, height, className, alt,
loading, etc.) unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4bb0ef51-d23d-4894-b99d-14e438988993

📥 Commits

Reviewing files that changed from the base of the PR and between e06362b and cc6f863.

📒 Files selected for processing (1)
  • src/routes/index.tsx

Keep the right-click brand actions on the hero splash logo while
still eliminating the Suspense fallback→loaded layout shift that
caused CLS. The component is now a normal import instead of
React.lazy, so it renders on the first pass with no swap.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant