Skip to content

Commit 58297e1

Browse files
committed
fix: enable passQuery for timeline API
1 parent de53377 commit 58297e1

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

app/pages/package-timeline/[[org]]/[packageName].vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ async function fetchTimeline(offset: number): Promise<TimelineResponse> {
5757
})
5858
}
5959
60-
// Initial load useAsyncData serializes the full response across SSR client
60+
// Initial load - useAsyncData serializes the full response across SSR to client
6161
const initialLoadError = ref(false)
6262
6363
const { data: initialTimeline } = await useAsyncData(
@@ -97,6 +97,7 @@ async function loadMore() {
9797
9898
const SIZE_INCREASE_THRESHOLD = 0.25
9999
const DEP_INCREASE_THRESHOLD = 5
100+
const NO_LICENSE_VALUES = ['', 'UNLICENSED']
100101
101102
const sizeCache = shallowReactive(new Map<string, InstallSizeResult>())
102103
const fetchingVersions = shallowReactive(new Set<string>())
@@ -117,7 +118,7 @@ async function fetchSize(ver: string) {
117118
)
118119
sizeCache.set(key, data)
119120
} catch {
120-
// silently skip size data is best-effort
121+
// silently skip - size data is best-effort
121122
} finally {
122123
fetchingVersions.delete(key)
123124
}
@@ -215,9 +216,11 @@ const versionSubEvents = computed(() => {
215216
const currentLicense = current.license ?? 'Unknown'
216217
const previousLicense = previous.license ?? 'Unknown'
217218
if (currentLicense !== previousLicense) {
219+
const hadNoLicense = NO_LICENSE_VALUES.includes(previousLicense)
220+
const hasNoLicense = NO_LICENSE_VALUES.includes(currentLicense)
218221
events.push({
219222
key: 'license',
220-
positive: false,
223+
positive: hadNoLicense && !hasNoLicense,
221224
icon: 'i-lucide:scale',
222225
text: t('package.timeline.license_change', { from: previousLicense, to: currentLicense }),
223226
})

nuxt.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@ export default defineNuxtConfig({
121121
allowQuery: ['mode', 'filterOldVersions', 'filterThreshold'],
122122
},
123123
},
124+
'/api/registry/timeline/**': {
125+
isr: {
126+
expiration: 300,
127+
passQuery: true,
128+
allowQuery: ['offset', 'limit'],
129+
},
130+
},
124131
'/api/registry/docs/**': { isr: true, cache: { maxAge: 365 * 24 * 60 * 60 } },
125132
'/api/registry/file/**': { isr: true, cache: { maxAge: 365 * 24 * 60 * 60 } },
126133
'/api/registry/provenance/**': { isr: true, cache: { maxAge: 365 * 24 * 60 * 60 } },

0 commit comments

Comments
 (0)