Skip to content

Canvas: the same filter reaches all metrics views or only one, depending on whether it was set from the bar or by clicking a table #9845

Description

@dfliess

On a canvas with more than one metrics view, the same dimension filter can end up applying to every metrics view or to just one, depending on how it was created. The filter bar renders the same single chip in both cases, so there is no way to tell which one you have.

  • Setting the filter from the filter bar writes f.<view>=... for every metrics view that declares the dimension.
  • Clicking a value inside a table writes f.<view>=... for that component's metrics view only.

To Reproduce

Using the demo, https://ui.rilldata.com/demo/rill-github-analytics/canvas/repo_compare_canvas. It has two metrics views, duckdb_commits_metrics and rill_commits_metrics, and both declare a username dimension.

Case A, from the filter bar:

  1. Open the canvas with ?tr=inf
  2. Click +, choose Username, select Aditya Hegde
  3. The URL becomes ?tr=inf&f.duckdb_commits_metrics=username IN ('Aditya Hegde')&f.rill_commits_metrics=username IN ('Aditya Hegde')
  4. Both halves filter. DuckDB "Number of commits" shows 0, Rill shows 754

Case B, clicking a table:

  1. Open the canvas with ?tr=inf
  2. In the table on the Rill side, click Aditya Hegde
  3. The URL becomes ?tr=inf&f.rill_commits_metrics=username IN ('Aditya Hegde')
  4. Only the Rill half filters. DuckDB "Number of commits" stays at 46,569 and its table still lists Mark Raasveldt, Mark, Tishj, Laurens Kuiper and the rest

In both cases the bar shows one chip, Username: Aditya Hegde, next to Clear filters, with nothing to distinguish them.

Expected behavior

We are not sure which scope should be the default, and per component scope may well be deliberate. What looks wrong to us is that the two paths disagree while looking identical on screen. A few directions, in case any is useful:

  1. Make both paths use the same scope
  2. Indicate in the chip which components a filter actually reaches, when it does not reach all of them
  3. Let the canvas author decide, for example a filters: scope: shared | per_metrics_view option in the YAML

Screenshots

Case A, filter set from the bar, DuckDB at 0:

Image

Case B, same filter set by clicking the table, DuckDB unchanged at 46,569:

Image

Desktop:

  • OS: macOS 15
  • Browser: Chrome
  • Version: Rill Cloud demo, as of 2026-08-31

Additional context

Where this came from: we have a canvas that mixes a sales metrics view and a receivables one, both with a salesperson dimension. Someone filtered by salesperson by clicking a table and the sales KPIs above did not move, then did the same from the bar and they did. It took us a while to work out why, and nothing on the screen explained it.

The two code paths, as far as we could follow them:

  • web-common/src/features/canvas/filters/filter-manager.ts, resolveFilterKey resolves a dimension against every metrics view that declares it
  • web-common/src/components/pivot/pivot-click-to-filter.ts calls applyFiltersToUrl(new Map([[metricsViewName, filterString]])) with only the component's own metrics view

Happy to send a PR if you tell us which direction you would prefer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions