diff --git a/app/composables/npm/useSearch.ts b/app/composables/npm/useSearch.ts index 6a804dcdb..39f33e65c 100644 --- a/app/composables/npm/useSearch.ts +++ b/app/composables/npm/useSearch.ts @@ -38,7 +38,7 @@ export function useSearch( } | null>(null) const isLoadingMore = shallowRef(false) - const isRateLimited = ref(false) + const isRateLimited = shallowRef(false) const suggestions = shallowRef([]) const suggestionsLoading = shallowRef(false) diff --git a/app/composables/useActiveTocItem.ts b/app/composables/useActiveTocItem.ts index db3fb1594..7807999a9 100644 --- a/app/composables/useActiveTocItem.ts +++ b/app/composables/useActiveTocItem.ts @@ -10,11 +10,10 @@ import type { Ref } from 'vue' * @public */ export function useActiveTocItem(toc: Ref) { - const activeId = ref(null) + const activeId = shallowRef(null) // Only run observer logic on client if (import.meta.server) { - // eslint-disable-next-line @typescript-eslint/no-empty-function return { activeId } } diff --git a/app/composables/useCanGoBack.ts b/app/composables/useCanGoBack.ts index 66435ae70..c55fabc10 100644 --- a/app/composables/useCanGoBack.ts +++ b/app/composables/useCanGoBack.ts @@ -1,5 +1,5 @@ export function useCanGoBack() { - const canGoBack = ref(false) + const canGoBack = shallowRef(false) const router = useRouter() diff --git a/app/composables/useCharts.ts b/app/composables/useCharts.ts index 68bfbe857..18a1918ef 100644 --- a/app/composables/useCharts.ts +++ b/app/composables/useCharts.ts @@ -312,11 +312,11 @@ export function useCharts() { ) const endDateOnly = toDateOnly(downloadEvolutionOptions.endDate) - const end = endDateOnly ? new Date(`${endDateOnly}T00:00:00.000Z`) : yesterday + const end = endDateOnly ? parseIsoDateOnly(endDateOnly) : yesterday const startDateOnly = toDateOnly(downloadEvolutionOptions.startDate) if (startDateOnly) { - const start = new Date(`${startDateOnly}T00:00:00.000Z`) + const start = parseIsoDateOnly(startDateOnly) return { start, end } } diff --git a/app/composables/useFileTreeState.ts b/app/composables/useFileTreeState.ts index e9baeb602..7c49eac5c 100644 --- a/app/composables/useFileTreeState.ts +++ b/app/composables/useFileTreeState.ts @@ -1,7 +1,5 @@ export function useFileTreeState(baseUrl: string) { - const stateKey = computed(() => `npmx-file-tree${baseUrl}`) - - const expanded = useState>(stateKey.value, () => new Set()) + const expanded = useState>(`npmx-file-tree${baseUrl}`, () => new Set()) function toggleDir(path: string) { if (expanded.value.has(path)) { diff --git a/app/composables/usePreferencesProvider.ts b/app/composables/usePreferencesProvider.ts index c01b7fdb2..305545540 100644 --- a/app/composables/usePreferencesProvider.ts +++ b/app/composables/usePreferencesProvider.ts @@ -1,3 +1,5 @@ +import { defu } from 'defu' + /** * Abstraction for preferences storage * Currently uses localStorage, designed for future user prefs API @@ -58,9 +60,9 @@ function createLocalStorageProvider(key: string): StorageProvider { * Abstracts the storage mechanism to allow future migration to API-based storage * */ -export function usePreferencesProvider(defaultValue: T) { +export function usePreferencesProvider(defaultValue: T) { const provider = createLocalStorageProvider(STORAGE_KEY) - const data = ref(defaultValue) as Ref + const data = ref(defaultValue) const isHydrated = shallowRef(false) // Load from storage on client @@ -68,7 +70,7 @@ export function usePreferencesProvider(defaultValue: T) { const stored = provider.get() if (stored) { // Merge stored values with defaults to handle schema evolution - data.value = { ...defaultValue, ...stored } + data.value = defu(stored, defaultValue) } isHydrated.value = true }) diff --git a/app/pages/package/[[org]]/[name].vue b/app/pages/package/[[org]]/[name].vue index 1722dc0b9..7253e8648 100644 --- a/app/pages/package/[[org]]/[name].vue +++ b/app/pages/package/[[org]]/[name].vue @@ -453,7 +453,7 @@ const isLoadingLikeData = computed( () => likeStatus.value !== 'error' && likeStatus.value !== 'success', ) -const isLikeActionPending = ref(false) +const isLikeActionPending = shallowRef(false) const likeAction = async () => { if (user.value?.handle == null) {