perf: further reduce memory (#7015)

* feat: server source maps

* perf: strip unused fields from search results

* perf: reduce game version memory usage
This commit is contained in:
Michael H.
2026-08-06 15:39:06 +00:00
committed by GitHub
parent c671ca52f6
commit b8d97268cb
5 changed files with 67 additions and 24 deletions
@@ -0,0 +1,19 @@
import type { Labrinth } from '@modrinth/api-client'
import { setGameVersions } from '~/composables/generated'
export default defineNuxtPlugin((nuxtApp) => {
// Deferred until after hydration: the server renders with the build-time game versions, so
// swapping them in during setup would make the first client render disagree with the markup.
nuxtApp.hook('app:suspense:resolve', async () => {
try {
const gameVersions = await $fetch<Labrinth.Tags.v2.GameVersion[]>('/api/tags/game-versions')
if (gameVersions && gameVersions.length > 0) {
setGameVersions(gameVersions)
}
} catch (error) {
console.error('[Game Version Updater] Failed to fetch:', error)
}
})
})
@@ -1,17 +0,0 @@
import type { Labrinth } from '@modrinth/api-client'
export default defineNuxtPlugin(async () => {
try {
const gameVersions = await $fetch<Labrinth.Tags.v2.GameVersion[]>('/api/tags/game-versions')
if (gameVersions && gameVersions.length > 0) {
const state = useState<{ gameVersions: Labrinth.Tags.v2.GameVersion[] }>('generatedState')
if (state.value) {
state.value.gameVersions = gameVersions
}
}
} catch (error) {
console.error('[Game Version Updater] Failed to fetch:', error)
}
})