Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/composables/npm/useSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function useSearch(
} | null>(null)

const isLoadingMore = shallowRef(false)
const isRateLimited = ref(false)
const isRateLimited = shallowRef(false)

const suggestions = shallowRef<SearchSuggestion[]>([])
const suggestionsLoading = shallowRef(false)
Expand Down
3 changes: 1 addition & 2 deletions app/composables/useActiveTocItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ import type { Ref } from 'vue'
* @public
*/
export function useActiveTocItem(toc: Ref<TocItem[]>) {
const activeId = ref<string | null>(null)
const activeId = shallowRef<string | null>(null)

// Only run observer logic on client
if (import.meta.server) {
// eslint-disable-next-line @typescript-eslint/no-empty-function
return { activeId }
}

Expand Down
2 changes: 1 addition & 1 deletion app/composables/useCanGoBack.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export function useCanGoBack() {
const canGoBack = ref(false)
const canGoBack = shallowRef(false)

const router = useRouter()

Expand Down
4 changes: 2 additions & 2 deletions app/composables/useCharts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}

Expand Down
4 changes: 1 addition & 3 deletions app/composables/useFileTreeState.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
export function useFileTreeState(baseUrl: string) {
const stateKey = computed(() => `npmx-file-tree${baseUrl}`)

const expanded = useState<Set<string>>(stateKey.value, () => new Set<string>())
const expanded = useState<Set<string>>(`npmx-file-tree${baseUrl}`, () => new Set<string>())

function toggleDir(path: string) {
if (expanded.value.has(path)) {
Expand Down
8 changes: 5 additions & 3 deletions app/composables/usePreferencesProvider.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { defu } from 'defu'

/**
* Abstraction for preferences storage
* Currently uses localStorage, designed for future user prefs API
Expand Down Expand Up @@ -58,17 +60,17 @@ function createLocalStorageProvider<T>(key: string): StorageProvider<T> {
* Abstracts the storage mechanism to allow future migration to API-based storage
*
*/
export function usePreferencesProvider<T>(defaultValue: T) {
export function usePreferencesProvider<T extends object>(defaultValue: T) {
const provider = createLocalStorageProvider<T>(STORAGE_KEY)
const data = ref<T>(defaultValue) as Ref<T>
const data = ref<T>(defaultValue)
const isHydrated = shallowRef(false)

// Load from storage on client
onMounted(() => {
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
})
Expand Down
2 changes: 1 addition & 1 deletion app/pages/package/[[org]]/[name].vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading