Skip to content

Commit

Permalink
Fix non-reactive time range initialization when user navigates to das…
Browse files Browse the repository at this point in the history
…hboard (#2449)
  • Loading branch information
hamilton authored May 17, 2023
1 parent 225a65a commit 86cafae
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
getTimeGrainOptions,
} from "@rilldata/web-common/lib/time/grains";
import {
convertTimeRangePreset,
ISODurationToTimePreset,
convertTimeRangePreset,
isRangeInsideOther,
} from "@rilldata/web-common/lib/time/ranges";
import {
Expand All @@ -31,12 +31,11 @@
TimeRangeType,
} from "@rilldata/web-common/lib/time/types";
import {
createRuntimeServiceGetCatalogEntry,
V1TimeGrain,
createRuntimeServiceGetCatalogEntry,
} from "@rilldata/web-common/runtime-client";
import type { CreateQueryResult } from "@tanstack/svelte-query";
import { useQueryClient } from "@tanstack/svelte-query";
import { get } from "svelte/store";
import { runtime } from "../../../runtime-client/runtime-store";
import { metricsExplorerStore, useDashboardStore } from "../dashboard-stores";
import NoTimeDimensionCTA from "./NoTimeDimensionCTA.svelte";
Expand Down Expand Up @@ -96,7 +95,8 @@
// Once we have the allTimeRange, set the default time range and time grain.
// This is a temporary workaround with high potential to break. We should refactor this defaulting logic to live with the store, not as part of a component.
$: if (allTimeRange && allTimeRange?.start && isDashboardDefined) {
const selectedTimeRange = get(dashboardStore)?.selectedTimeRange;
const selectedTimeRange = $dashboardStore?.selectedTimeRange;
if (!selectedTimeRange) {
setDefaultTimeControls(allTimeRange);
} else {
Expand Down

2 comments on commit 86cafae

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Published on https://ui.rilldata.com as production
🚀 Deployed on https://6465471ecd72e71fc796314f--rill-ui.netlify.app

Please sign in to comment.