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]);
|
}, [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.
|
// 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
|
// the function passed to useMemo runs during rendering, so when we get a different
|
||||||
// amount of data, structureRev is incremented before we render it
|
// 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(() => {
|
useEffect(() => {
|
||||||
if (onHiddenSeriesChanged) {
|
if (onHiddenSeriesChanged) {
|
||||||
@ -138,8 +140,6 @@ export function ExploreGraph({
|
|||||||
}
|
}
|
||||||
}, [dataWithConfig, onHiddenSeriesChanged]);
|
}, [dataWithConfig, onHiddenSeriesChanged]);
|
||||||
|
|
||||||
const seriesToShow = showAllTimeSeries ? dataWithConfig : dataWithConfig.slice(0, MAX_NUMBER_OF_TIME_SERIES);
|
|
||||||
|
|
||||||
const panelContext: PanelContext = {
|
const panelContext: PanelContext = {
|
||||||
eventBus,
|
eventBus,
|
||||||
sync: () => DashboardCursorSync.Crosshair,
|
sync: () => DashboardCursorSync.Crosshair,
|
||||||
|
Loading…
Reference in New Issue
Block a user