@@ -320,19 +320,13 @@ const effectivePackageNames = computed<string[]>(() => {
320320 return single ? [single ] : []
321321})
322322
323- const granularityLocal = shallowRef <ChartTimeGranularity >(DEFAULT_GRANULARITY )
324- const granularityRoute = useRouteQuery <ChartTimeGranularity >(' granularity' , DEFAULT_GRANULARITY )
325-
326- const selectedGranularity = computed ({
327- get : () => (props .permalink ? granularityRoute .value : granularityLocal .value ),
328- set : (value : ChartTimeGranularity ) => {
329- if (props .permalink ) {
330- granularityRoute .value = value
331- } else {
332- granularityLocal .value = value
333- }
323+ const selectedGranularity = usePermalinkValue <ChartTimeGranularity >(
324+ ' granularity' ,
325+ DEFAULT_GRANULARITY ,
326+ {
327+ permanent: props .permalink ,
334328 },
335- } )
329+ )
336330
337331const displayedGranularity = shallowRef <ChartTimeGranularity >(DEFAULT_GRANULARITY )
338332
@@ -363,31 +357,11 @@ const shouldRenderEstimationOverlay = computed(
363357 () => ! pending .value && isEstimationGranularity .value ,
364358)
365359
366- const startDateLocal = shallowRef <string >(' ' )
367- const endDateLocal = shallowRef <string >(' ' )
368- const startDateRoute = useRouteQuery <string >(' start' , ' ' )
369- const endDateRoute = useRouteQuery <string >(' end' , ' ' )
370-
371- const startDate = computed ({
372- get : () => (props .permalink ? startDateRoute .value : startDateLocal .value ),
373- set : (value : string ) => {
374- if (props .permalink ) {
375- startDateRoute .value = value
376- } else {
377- startDateLocal .value = value
378- }
379- },
360+ const startDate = usePermalinkValue <string >(' start' , ' ' , {
361+ permanent: props .permalink ,
380362})
381-
382- const endDate = computed ({
383- get : () => (props .permalink ? endDateRoute .value : endDateLocal .value ),
384- set : (value : string ) => {
385- if (props .permalink ) {
386- endDateRoute .value = value
387- } else {
388- endDateLocal .value = value
389- }
390- },
363+ const endDate = usePermalinkValue <string >(' end' , ' ' , {
364+ permanent: props .permalink ,
391365})
392366
393367const hasUserEditedDates = shallowRef (false )
0 commit comments