fix(usage): pass scope to the time series chart fetch

The Usage page's chart fetch (``fetchTimeSeriesData``) spread
``chartFilters`` plus dates and filters, but never forwarded
``commonFilters.scope`` — so it implicitly fell back to the
backend's ``scope=all`` default. The three breakdown tables
(``apikeys-table``, ``models-table``, ``users-table``) all pass
``scope`` explicitly, which produced an inconsistent picture on
the same page: an Org owner viewing a model granted from another
Org saw the date chart render empty while the tables underneath
showed identical usage rows.

Forward ``currentSelectedFilters.scope`` alongside the rest of the
common filters so the chart and the tables ask the backend the
same question.
This commit is contained in:
gitlawr
2026-05-25 13:56:25 +08:00
committed by jialin
parent 4b14fa6ca8
commit 9c519d937d
@@ -208,6 +208,12 @@ export const useUsageFilters = ({
fetchTimeSeriesData({
...currentChartFilters,
group_by: groupByArray,
// Without ``scope`` the backend defaults to ``all``, while the
// breakdown tables pass ``scope`` explicitly. The mismatch makes
// the chart and the tables run different filters on the same
// page — an Org owner viewing a cross-Org-granted model sees the
// chart empty while the tables render the same usage.
scope: currentSelectedFilters.scope,
start_date: currentSelectedFilters.start_date,
end_date: currentSelectedFilters.end_date,
filters: nextFilters