Skip to content

fix: avoid spurious filter resets from concurrent loadDashboard calls#94

Merged
jtroup merged 1 commit intostacklet/integrationfrom
elmo/fix-e2e
Mar 6, 2026
Merged

fix: avoid spurious filter resets from concurrent loadDashboard calls#94
jtroup merged 1 commit intostacklet/integrationfrom
elmo/fix-e2e

Conversation

@jtroup
Copy link

@jtroup jtroup commented Mar 6, 2026

what

In useDashboard.js, changed setFilters(updatedFilters) to a
functional update that preserves the existing state reference when
filter values are unchanged (using lodash.isEqual).

why

The failing e2e test Dashboard Filters > filters rows in a Table Visualization exposed a race condition introduced by the axios 0.30.x /
werkzeug 3.x upgrade (PR #88), which shifted request-completion timing.

On dashboard mount, two useEffect hooks independently call
loadDashboard(). Each call resolves its widget promises and calls
setFilters(collectDashboardFilters(...)). collectDashboardFilters
always returns a new array reference even when filter values are
identical. Each new reference triggers a useEffect in
VisualizationRenderer that calls combineFilters(localFilters, globalFilters), resetting any user-modified local filter selection back
to the global default.

With the new timing, this reset was firing after the test clicked a
filter option, causing the widget to display 4 rows instead of the
expected 3.

By preserving the existing reference when values are unchanged, spurious
effect triggers in VisualizationRenderer are suppressed, and local
filter selections survive concurrent loadDashboard() completions.

testing

Covered by the existing Cypress e2e test
client/cypress/integration/dashboard/filters_spec.js — specifically
Dashboard Filters > filters rows in a Table Visualization.

docs

No docs needed.


🤖 Generated with Claude Code

Copy link

@ephan ephan left a comment

Choose a reason for hiding this comment

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

This looks good to me @jtroup

@jtroup jtroup merged commit ebfce4f into stacklet/integration Mar 6, 2026
4 checks passed
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