mirror of
https://github.com/grafana/grafana.git
synced 2024-11-22 08:56:43 -06:00
Explore: Graph should reuse old time range while waiting for queries (#79725)
* Do not pass frames forward until data is done loading * UsePrevious to get last timerange before query is done
This commit is contained in:
parent
80da35f41d
commit
5e9e6ddaf7
@ -1,5 +1,6 @@
|
||||
import { identity } from 'lodash';
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
import { usePrevious } from 'react-use';
|
||||
|
||||
import {
|
||||
AbsoluteTimeRange,
|
||||
@ -77,17 +78,18 @@ export function ExploreGraph({
|
||||
eventBus,
|
||||
}: Props) {
|
||||
const theme = useTheme2();
|
||||
|
||||
const previousTimeRange = usePrevious(absoluteRange);
|
||||
const baseTimeRange = loadingState === LoadingState.Loading && previousTimeRange ? previousTimeRange : absoluteRange;
|
||||
const timeRange = useMemo(
|
||||
() => ({
|
||||
from: dateTime(absoluteRange.from),
|
||||
to: dateTime(absoluteRange.to),
|
||||
from: dateTime(baseTimeRange.from),
|
||||
to: dateTime(baseTimeRange.to),
|
||||
raw: {
|
||||
from: dateTime(absoluteRange.from),
|
||||
to: dateTime(absoluteRange.to),
|
||||
from: dateTime(baseTimeRange.from),
|
||||
to: dateTime(baseTimeRange.to),
|
||||
},
|
||||
}),
|
||||
[absoluteRange.from, absoluteRange.to]
|
||||
[baseTimeRange.from, baseTimeRange.to]
|
||||
);
|
||||
|
||||
const fieldConfigRegistry = useMemo(
|
||||
|
Loading…
Reference in New Issue
Block a user