mirror of
https://github.com/grafana/grafana.git
synced 2024-12-01 21:19:28 -06:00
Explore: Reset Graph overrides if underlying series changes (#49680)
This commit is contained in:
parent
e25a49ff49
commit
a59066a21d
@ -75,12 +75,8 @@ export function ExploreGraph({
|
||||
|
||||
const previousData = usePrevious(data);
|
||||
const structureChangesRef = useRef(0);
|
||||
|
||||
if (data && previousData && !compareArrayValues(previousData, data, compareDataFrameStructures)) {
|
||||
structureChangesRef.current++;
|
||||
}
|
||||
|
||||
const structureRev = baseStructureRev + structureChangesRef.current;
|
||||
const prevStructureRev = usePrevious(structureRev);
|
||||
|
||||
const [fieldConfig, setFieldConfig] = useState<FieldConfigSource>({
|
||||
defaults: {
|
||||
@ -96,6 +92,14 @@ export function ExploreGraph({
|
||||
overrides: [],
|
||||
});
|
||||
|
||||
if (data && previousData && !compareArrayValues(previousData, data, compareDataFrameStructures)) {
|
||||
structureChangesRef.current++;
|
||||
|
||||
if (prevStructureRev === structureRev) {
|
||||
setFieldConfig({ ...fieldConfig, overrides: [] });
|
||||
}
|
||||
}
|
||||
|
||||
const style = useStyles2(getStyles);
|
||||
const timeRange = {
|
||||
from: dateTime(absoluteRange.from),
|
||||
|
Loading…
Reference in New Issue
Block a user