Skip to content

Commit 68e7db6

Browse files
committed
feat: remove double get versions request, only call v3
1 parent 1fd38a5 commit 68e7db6

File tree

1 file changed

+12
-23
lines changed

1 file changed

+12
-23
lines changed

apps/frontend/src/pages/[type]/[id].vue

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,20 +1551,6 @@ const {
15511551
15521552
const dependencies = computed(() => dependenciesRaw.value ?? null)
15531553
1554-
// V2 Versions - lazy loaded client-side only
1555-
const {
1556-
data: versionsV2Raw,
1557-
error: _versionsError,
1558-
isFetching: versionsV2Loading,
1559-
refetch: resetVersionsV2,
1560-
} = useQuery({
1561-
queryKey: computed(() => ['project', projectId.value, 'versions', 'v2']),
1562-
queryFn: () =>
1563-
client.labrinth.versions_v3.getProjectVersions(projectId.value, { include_changelog: false }),
1564-
staleTime: 1000 * 60 * 5,
1565-
enabled: false, // Never auto-fetch, always triggered manually
1566-
})
1567-
15681554
// V3 Versions - lazy loaded client-side only
15691555
const {
15701556
data: versionsV3,
@@ -1591,12 +1577,16 @@ const { data: organization, refetch: _resetOrganization } = useQuery({
15911577
enabled: computed(() => !!projectId.value && !!projectRaw.value?.organization),
15921578
})
15931579
1594-
// Merge V2 versions with V3 environment data
1580+
// Transform versionsV3 to be same shape as versionsV2 for compatibility in project pages
15951581
const versionsRaw = computed(() => {
1596-
return (versionsV2Raw.value ?? []).map((v) => ({
1597-
...v,
1598-
environment: versionsV3.value?.find((v3) => v3.id === v.id)?.environment,
1599-
}))
1582+
return (versionsV3.value ?? []).map((v) => {
1583+
const isModpack = v.project_types?.includes('modpack')
1584+
1585+
return {
1586+
...v,
1587+
loaders: isModpack && v.mrpack_loaders ? v.mrpack_loaders : v.loaders,
1588+
}
1589+
})
16001590
})
16011591
16021592
// Apply version computations (slug generation, author lookup, etc.)
@@ -1606,13 +1596,13 @@ const versions = computed(() => {
16061596
})
16071597
16081598
// Versions loading state
1609-
const versionsLoading = computed(() => versionsV2Loading.value || versionsV3Loading.value)
1599+
const versionsLoading = computed(() => versionsV3Loading.value)
16101600
16111601
// Load versions on demand (client-side only)
16121602
async function loadVersions() {
16131603
// Skip if already loaded or loading
1614-
if (versionsV2Raw.value || versionsV2Loading.value) return
1615-
await Promise.all([resetVersionsV2(), resetVersionsV3()])
1604+
if (versionsV3.value || versionsV3Loading.value) return
1605+
await resetVersionsV3()
16161606
}
16171607
16181608
// Load dependencies on demand (client-side only)
@@ -1653,7 +1643,6 @@ async function resetProject() {
16531643
}
16541644
16551645
async function resetVersions() {
1656-
await resetVersionsV2()
16571646
await resetVersionsV3()
16581647
}
16591648

0 commit comments

Comments
 (0)