Skip to content

Commit 51daf49

Browse files
authored
fix: citation url when metrics view MetricsViewTimeRange data is missing (#9160)
* fix: citation url when time range summary is missing * Fix lint
1 parent cc78bd1 commit 51daf49

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

  • web-common/src/features/explore-mappers

web-common/src/features/explore-mappers/utils.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
type V1TimeRangeSummary,
3333
} from "@rilldata/web-common/runtime-client";
3434
import type { RuntimeClient } from "@rilldata/web-common/runtime-client/v2";
35+
3536
// We are manually sending in duration, offset and round to grain for previous complete ranges.
3637
// This is to map back that split
3738
const PreviousCompleteRangeReverseMap: Record<string, TimeRangePreset> = {};
@@ -207,6 +208,7 @@ export async function getExplorePageUrlSearchParams(
207208
/**
208209
* Sync method to get explore page url search params if metrics view time range is present in cache.
209210
* Else the map will have to happen in the `/-/open-query` route.
211+
* @param instanceId
210212
* @param exploreState
211213
* @param metricsViewSpec
212214
* @param exploreSpec
@@ -228,7 +230,6 @@ export function maybeGetExplorePageUrlSearchParams(
228230
const queryResp = queryClient.getQueryData<V1MetricsViewTimeRangeResponse>(
229231
metricsViewTimeRangeQueryKey,
230232
);
231-
if (!queryResp) return null;
232233

233234
// This is just for an initial redirect.
234235
// DashboardStateDataLoader will handle compression etc. during init
@@ -240,7 +241,11 @@ export function maybeGetExplorePageUrlSearchParams(
240241
getTimeControlState(
241242
metricsViewSpec,
242243
exploreSpec,
243-
queryResp.timeRangeSummary,
244+
queryResp?.timeRangeSummary ?? {
245+
min: new Date(0).toISOString(),
246+
watermark: new Date().toISOString(),
247+
max: new Date().toISOString(),
248+
},
244249
exploreState,
245250
),
246251
);

0 commit comments

Comments
 (0)