mirror of
https://github.com/grafana/grafana.git
synced 2024-11-24 09:50:29 -06:00
Explore: Re-initialize graph when number of series to show changes (#60499)
This commit is contained in:
parent
838cbf22da
commit
e723021e13
@ -120,10 +120,12 @@ export function ExploreGraph({
|
||||
});
|
||||
}, [fieldConfigRegistry, data, timeZone, theme, styledFieldConfig]);
|
||||
|
||||
const seriesToShow = showAllTimeSeries ? dataWithConfig : dataWithConfig.slice(0, MAX_NUMBER_OF_TIME_SERIES);
|
||||
|
||||
// We need to increment structureRev when the number of series changes.
|
||||
// the function passed to useMemo runs during rendering, so when we get a different
|
||||
// amount of data, structureRev is incremented before we render it
|
||||
useMemo(inc, [dataWithConfig.length, styledFieldConfig, inc]);
|
||||
useMemo(inc, [dataWithConfig.length, styledFieldConfig, seriesToShow.length, inc]);
|
||||
|
||||
useEffect(() => {
|
||||
if (onHiddenSeriesChanged) {
|
||||
@ -138,8 +140,6 @@ export function ExploreGraph({
|
||||
}
|
||||
}, [dataWithConfig, onHiddenSeriesChanged]);
|
||||
|
||||
const seriesToShow = showAllTimeSeries ? dataWithConfig : dataWithConfig.slice(0, MAX_NUMBER_OF_TIME_SERIES);
|
||||
|
||||
const panelContext: PanelContext = {
|
||||
eventBus,
|
||||
sync: () => DashboardCursorSync.Crosshair,
|
||||
|
Loading…
Reference in New Issue
Block a user