Skip to content

fix(tools): eliminate groupBy flicker on page reload#2311

Open
waygeance wants to merge 1 commit intojson-schema-org:mainfrom
waygeance:fix-tooling-page-on-render
Open

fix(tools): eliminate groupBy flicker on page reload#2311
waygeance wants to merge 1 commit intojson-schema-org:mainfrom
waygeance:fix-tooling-page-on-render

Conversation

@waygeance
Copy link
Contributor

What kind of change does this PR introduce?

Bugfix (UI state initialization & flicker fix)

Issue Number:

Screenshots/videos:

Screen.Recording.2026-03-03.at.7.36.32.PM.mov

If relevant, did you update the documentation?

N/A

Summary

This PR fixes a UI flicker issue on the Tooling page where the default grouping (toolingTypes) briefly rendered before applying the selected value from URL query parameters.

Root Cause

The useToolsTransform hook:

  • Initialized state with hardcoded defaults
  • Then updated state inside useEffect after parsing router query
  • Since router.isReady is initially false, the default state rendered first, causing visible flicker

Solution

  • Introduced a getInitialTransform() helper to centralize query parsing logic
  • Initialized state directly from URL parameters
  • Added an isReady loading guard to prevent rendering until router is ready
  • Removed duplicated parsing logic inside useEffect
  • Updated dependency array to correctly respond to query changes

Result

  • Eliminates flicker completely
  • Ensures consistent behavior on page refresh and direct URL access
  • Improves code maintainability by removing duplicate logic
  • Maintains full backward compatibility
    Does this PR introduce a breaking change?

Checklist

Please ensure the following tasks are completed before submitting this pull request.

@waygeance waygeance requested a review from a team as a code owner March 3, 2026 14:17
@github-project-automation github-project-automation bot moved this to Ready to review in PR - Triage Group Mar 3, 2026
@github-actions
Copy link

github-actions bot commented Mar 3, 2026

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
website ✅ Ready (View Log) Visit Preview 2067279

@waygeance
Copy link
Contributor Author

Hi, could a maintainer please review this PR when convenient? Thanks ☺️

@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (dbfd6ea) to head (2067279).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #2311   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           30        30           
  Lines          672       672           
  Branches       211       211           
=========================================
  Hits           672       672           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready to review

Development

Successfully merging this pull request may close these issues.

🐛 Bug: Tooling page briefly renders default "Group By: Tooling Type" before applying selected value on reload

1 participant