-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: make dshboards "refreshable" #1784
base: main
Are you sure you want to change the base?
Conversation
Preview components from this PR in consuming applicationIn consuming application project install preview versions of shared packages generated by this PR:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to review.
@@ -127,6 +129,7 @@ const { | |||
queryFn, | |||
averageLatencies, | |||
abortController: props.abortController, | |||
refreshCounter: toRef(props, 'refreshCounter'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't toRef it here, it loses reactivity since it's being passed off to a util function 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the PR title before merging.
@@ -39,6 +39,7 @@ interface FetcherOptions { | |||
queryFn: AnalyticsBridge['queryFn'] | |||
averageLatencies: Ref<boolean>, | |||
abortController?: AbortController | |||
refreshCounter?: Ref<number> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the prop has a default value, this option will always be available.
refreshCounter?: Ref<number> | |
refreshCounter: Ref<number> |
@@ -115,7 +115,7 @@ export default function useMetricFetcher(opts: MetricFetcherOptions): FetcherRes | |||
// need to have some uniqueness in the cache key to avoid collisions. | |||
// this was happening when there are multiple providers on the same page with the same dimensions and metrics. | |||
// For example the singleProvider and multiProvider that appear in the test harness. | |||
return `metric-fetcher-${opts.timeframe.value.cacheKey()}-${opts.dimensions?.join('-')}-${opts.metrics.value?.join('-')}-${additionalFilterKey}` | |||
return `metric-fetcher-${opts.timeframe.value.cacheKey()}-${opts.dimensions?.join('-')}-${opts.metrics.value?.join('-')}-${additionalFilterKey}-${opts.refreshCounter?.value}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return `metric-fetcher-${opts.timeframe.value.cacheKey()}-${opts.dimensions?.join('-')}-${opts.metrics.value?.join('-')}-${additionalFilterKey}-${opts.refreshCounter?.value}` | |
return `metric-fetcher-${opts.timeframe.value.cacheKey()}-${opts.dimensions?.join('-')}-${opts.metrics.value?.join('-')}-${additionalFilterKey}-${opts.refreshCounter.value}` |
(With the above suggestion.)
@@ -173,7 +173,7 @@ export default function useMetricFetcher(opts: MetricFetcherOptions): FetcherRes | |||
}) | |||
|
|||
return { | |||
isLoading: computed(() => STATE.PENDING === metricRequestState.value), | |||
isLoading: computed(() => [STATE.PENDING, STATE.VALIDATING, STATE.VALIDATING_HAS_DATA].includes(metricRequestState.value)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm. This makes the auto-refresh UX very noisy -- the page drops to loading states every time the charts update. I'm not aware of many uses of auto-refresh right now, so this is probably an acceptable trade-off right now, but I'll poke Christian and Helen.
@@ -16,4 +16,5 @@ export interface MetricFetcherOptions { | |||
queryReady: Ref<boolean> | |||
queryFn: AnalyticsBridge['queryFn'] | |||
abortController?: AbortController | |||
refreshCounter?: Ref<number> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refreshCounter?: Ref<number> | |
refreshCounter: Ref<number> |
@@ -31,8 +31,10 @@ const props = withDefaults(defineProps<{ | |||
context: DashboardRendererContextInternal, | |||
height?: number, | |||
queryReady: boolean, | |||
refreshCounter?: number, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be optional? The renderer is the only thing that renders tiles, and it always provides the counter...
Summary
https://konghq.atlassian.net/browse/MA-3089
https://www.loom.com/share/afcd026de712408da886e722cb044395