fix: invalidate tanstack caches on user auth (#5341)

* fix: invalidate tanstack caches on user auth

* refactor: clean up invalidate flow

* fix: lint
This commit is contained in:
Calum H.
2026-02-09 14:43:33 +00:00
committed by GitHub
parent e962521492
commit 90438a1ad5
16 changed files with 105 additions and 198 deletions

View File

@@ -140,7 +140,7 @@ export class NuxtModrinthClient extends XHRUploadClient {
protected async executeRequest<T>(url: string, options: RequestOptions): Promise<T> {
try {
// @ts-expect-error - $fetch is provided by Nuxt runtime
// @ts-expect-error - $fetch is provided by Nuxt
const response = await $fetch<T>(url, {
method: options.method ?? 'GET',
headers: options.headers,
@@ -148,6 +148,8 @@ export class NuxtModrinthClient extends XHRUploadClient {
params: options.params,
timeout: options.timeout,
signal: options.signal,
// @ts-expect-error - import.meta is provided by Nuxt
cache: import.meta.server ? undefined : 'no-store',
})
return response

View File

@@ -17,15 +17,12 @@ export interface ProjectPageContext {
dependencies: Ref<Labrinth.Projects.v2.DependencyInfo | null>
dependenciesLoading: Ref<boolean>
// Refresh functions (invalidate + refetch)
refreshProject: () => Promise<void>
refreshVersions: () => Promise<void>
refreshMembers: () => Promise<void>
refreshOrganization: () => Promise<void>
// Invalidate all project queries (auto-refetches active ones)
invalidate: () => Promise<void>
// Lazy loading
loadVersions: () => Promise<void>
loadDependencies: () => Promise<void>
loadVersions: () => void
loadDependencies: () => void
// Mutation functions
patchProject: (data: Record<string, unknown>, quiet?: boolean) => Promise<boolean>