Skip to content

Bug 2058000 - Fix filter changes having no effect after loading more pushes - #9744

Open
camd wants to merge 1 commit into
masterfrom
camd/bug-2058000-filter-after-get-next
Open

Bug 2058000 - Fix filter changes having no effect after loading more pushes#9744
camd wants to merge 1 commit into
masterfrom
camd/bug-2058000-filter-after-get-next

Conversation

@camd

@camd camd commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Problem

Bug 2058000: after clicking "get next N" to load more pushes, changing the shown task tiers (or any other filter — result status, classified state, etc.) had no effect. The tier button highlighted, the URL updated, but no additional jobs appeared until the page was reloaded.

Root cause

When "get next N" loads more pushes, the pushes store writes fromchange to the URL and dispatches a filtersUpdated event. App's handler for that event rebuilt the filter model as new FilterModel(navigate, window.location) — storing the live window.location object as filterModel.location.

That live object poisons the staleness check that drives filter re-renders. On the next filter toggle, handleUrlChanges asks hasUrlFilterChanges(filterModel.location.search, location.search) to decide whether to build a fresh FilterModel — but filterModel.location is window.location, which by then already reflects the post-navigation URL. The check compares the URL against itself, never detects the change, and setFilterModel never fires. The memoized job tree (PushJobs/Platform/JobGroup) keeps the old filter-model identity and never re-filters. The tier button still highlights because SecondaryNavBar re-renders via useLocation and reads the in-place-mutated urlParams — matching the reported symptom exactly: button responds, jobs don't.

Fix

handleFiltersUpdated now snapshots { pathname, search, hash } from window.location instead of storing the live object.

Relationship to #9721

This is a sibling of #9721 (push list resetting to latest 10 pushes) — both stem from the same URL-drift family, where raw pushState writes leave React Router's location out of sync with window.location. But they are distinct defects and both fixes are needed:

The two changes touch different files and do not conflict; they can land in either order.

Testing

New regression test tests/ui/job-view/FilterAfterLoadMorePushes_test.jsx walks the reported STR: load 10 pushes → "get next 10" → fromchange written → toggle a filter → shown jobs must update. It fails on master at exactly the reported symptom (URL updates, jobs don't) and passes with the fix.

The test deliberately uses BrowserRouter: under MemoryRouter the router location and window.location never refer to the same URL, so the bug cannot manifest — which is why the existing filtering tests never caught it.

Full unit suite: 94 suites / 1048 tests pass. Lint clean.

@netlify

netlify Bot commented Jul 31, 2026

Copy link
Copy Markdown

Deploy Preview for treeherder ready!

Name Link
🔨 Latest commit fb123f3
🔍 Latest deploy log https://app.netlify.com/projects/treeherder/deploys/6a6ce09f9303130008e3b21d
😎 Deploy Preview https://deploy-preview-9744--treeherder.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

…pushes

When 'get next N' loads more pushes, the pushes store writes fromchange
to the URL and dispatches a filtersUpdated event. App's handler rebuilt
the FilterModel with the live window.location object, so the staleness
check in handleUrlChanges (hasUrlFilterChanges) always compared the
current URL against itself and never detected later filter changes.
setFilterModel never fired again, the memoized job tree kept the old
filter model, and tier (or any other filter) toggles were no-ops until
a page reload.

Fix: snapshot pathname/search/hash instead of storing the live object.

The regression test must use BrowserRouter: under MemoryRouter the
router location and window.location never refer to the same URL, so the
bug cannot manifest (which is why existing filtering tests missed it).
@camd
camd force-pushed the camd/bug-2058000-filter-after-get-next branch from aeb88e7 to fb123f3 Compare July 31, 2026 17:51
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.26%. Comparing base (82f449a) to head (fb123f3).

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #9744       +/-   ##
===========================================
+ Coverage   69.68%   83.26%   +13.57%     
===========================================
  Files         629      630        +1     
  Lines       37413    37446       +33     
  Branches     3296     3351       +55     
===========================================
+ Hits        26073    31181     +5108     
+ Misses      11191     5884     -5307     
- Partials      149      381      +232     

☔ View full report in Codecov by Harness.
📢 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

None yet

Development

Successfully merging this pull request may close these issues.

2 participants