mirror of
https://github.com/modrinth/code.git
synced 2026-08-25 00:55:25 +00:00
* feat: server source maps * perf: strip unused fields from search results * perf: reduce game version memory usage
20 lines
692 B
TypeScript
20 lines
692 B
TypeScript
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)
|
|
}
|
|
})
|
|
})
|