A continuation of HomeBox the inventory and organization system built for the Home User
fix: prevent repeated calls of useLocalStorage to prevent rerender loop
tonyaellie90b69123f44b
diff --git a/frontend/components/Item/AttachmentsList.vue b/frontend/components/Item/AttachmentsList.vueindex 1a09c335..9e84228b 100644--- a/frontend/components/Item/AttachmentsList.vue+++ b/frontend/components/Item/AttachmentsList.vue@@ -10,24 +10,28 @@<span class="ml-2 w-0 flex-1 truncate"> {{ attachment.title }}</span></div><div class="ml-4 flex shrink-0 gap-2">- <!-- <TooltipProvider :delay-duration="0">+ <TooltipProvider :delay-duration="0"><Tooltip>- <TooltipTrigger as-child> -->- <a :class="buttonVariants({ size: 'icon' })" :href="attachmentURL(attachment.id)" :download="attachment.title">- <MdiDownload />- </a>- <!-- </TooltipTrigger>+ <TooltipTrigger as-child>+ <a+ :class="buttonVariants({ size: 'icon' })"+ :href="attachmentURL(attachment.id)"+ :download="attachment.title"+ >+ <MdiDownload />+ </a>+ </TooltipTrigger><TooltipContent> {{ $t("components.item.attachments_list.download") }} </TooltipContent></Tooltip><Tooltip>- <TooltipTrigger as-child> -->- <a :class="buttonVariants({ size: 'icon' })" :href="attachmentURL(attachment.id)" target="_blank">- <MdiOpenInNew />- </a>- <!-- </TooltipTrigger>+ <TooltipTrigger as-child>+ <a :class="buttonVariants({ size: 'icon' })" :href="attachmentURL(attachment.id)" target="_blank">+ <MdiOpenInNew />+ </a>+ </TooltipTrigger><TooltipContent> {{ $t("components.item.attachments_list.open_new_tab") }} </TooltipContent></Tooltip>- </TooltipProvider> -->+ </TooltipProvider></div></li></ul>@@ -39,7 +43,7 @@import MdiDownload from "~icons/mdi/download";import MdiOpenInNew from "~icons/mdi/open-in-new";import { buttonVariants } from "@/components/ui/button";- // import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";+ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";const props = defineProps({attachments: {diff --git a/frontend/composables/use-preferences.ts b/frontend/composables/use-preferences.tsindex bb7bc23f..9e4ec85b 100644--- a/frontend/composables/use-preferences.ts+++ b/frontend/composables/use-preferences.ts@@ -34,39 +34,39 @@ export type LocationViewPreferences = {};};+const results = useLocalStorage(+ "homebox/preferences/location",+ {+ showDetails: true,+ showEmpty: true,+ editorAdvancedView: false,+ itemDisplayView: "card",+ theme: "homebox",+ itemsPerTablePage: 10,+ collectionId: null,+ displayLegacyHeader: false,+ legacyImageFit: false,+ language: null,+ overrideFormatLocale: null,+ duplicateSettings: {+ copyMaintenance: false,+ copyAttachments: true,+ copyCustomFields: true,+ copyPrefixOverride: null,+ },+ shownMultiTabWarning: false,+ quickActions: {+ enabled: true,+ },+ },+ { mergeDefaults: true }+);+/*** useViewPreferences loads the view preferences from local storage and hydrates* them. These are reactive and will update the local storage when changed.*/export function useViewPreferences(): Ref<LocationViewPreferences> {- const results = useLocalStorage(- "homebox/preferences/location",- {- showDetails: true,- showEmpty: true,- editorAdvancedView: false,- itemDisplayView: "card",- theme: "homebox",- itemsPerTablePage: 10,- collectionId: null,- displayLegacyHeader: false,- legacyImageFit: false,- language: null,- overrideFormatLocale: null,- duplicateSettings: {- copyMaintenance: false,- copyAttachments: true,- copyCustomFields: true,- copyPrefixOverride: null,- },- shownMultiTabWarning: false,- quickActions: {- enabled: true,- },- },- { mergeDefaults: true }- );-// casting is required because the type returned is removable, however since we// use `mergeDefaults` the result _should_ always be present.return results as unknown as Ref<LocationViewPreferences>;