diff --git a/public/app/features/explore/ExploreGraph.tsx b/public/app/features/explore/ExploreGraph.tsx index 42c02f64a98..a983741b1bb 100644 --- a/public/app/features/explore/ExploreGraph.tsx +++ b/public/app/features/explore/ExploreGraph.tsx @@ -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({ 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),