fix: conditionally fetch (#5157)

* fix: conditionally fetch

* fix: yeet
This commit is contained in:
Calum H.
2026-01-19 21:57:49 +00:00
committed by GitHub
parent 11fe90a69b
commit 976644d1e6
3 changed files with 4 additions and 57 deletions

View File

@@ -754,9 +754,10 @@ const route = useNativeRoute()
const router = useNativeRouter()
const link = config.public.siteUrl + route.path.replace(/\/+$/, '')
const { data: payoutBalance } = await useAsyncData('payout/balance', () =>
useBaseFetch('payout/balance', { apiVersion: 3 }),
)
const { data: payoutBalance } = await useAsyncData('payout/balance', () => {
if (!auth.value.user) return null
return useBaseFetch('payout/balance', { apiVersion: 3 })
})
const showTaxComplianceBanner = computed(() => {
if (flags.value.testTaxForm && auth.value.user) return true

View File

@@ -1,17 +0,0 @@
export default definePayloadPlugin(() => {
definePayloadReducer('IntlMessageFormat', (value) => {
if (value?.constructor?.name === 'IntlMessageFormat' || value?._ast !== undefined) {
if (import.meta.dev) {
console.warn('[i18n] IntlMessageFormat instance leaked into payload - returning null')
console.warn('[i18n] This indicates a bug that should be fixed upstream')
console.warn('[i18n] Leaked value:', value)
}
return null
}
return false
})
definePayloadReviver('IntlMessageFormat', () => null)
})

View File

@@ -1,37 +0,0 @@
function findNonPOJOs(
obj: unknown,
path: string,
found: Array<{ path: string; type: string }> = [],
): Array<{ path: string; type: string }> {
if (obj === null || typeof obj !== 'object') return found
const proto = Object.getPrototypeOf(obj)
if (proto !== Object.prototype && proto !== null && !Array.isArray(obj)) {
found.push({ path, type: obj.constructor?.name ?? 'Unknown' })
}
for (const [key, value] of Object.entries(obj)) {
findNonPOJOs(value, `${path}.${key}`, found)
}
return found
}
export default defineNuxtPlugin((nuxtApp) => {
if (!import.meta.dev || !import.meta.server) return
nuxtApp.hooks.hook('app:rendered', () => {
try {
JSON.stringify(nuxtApp.payload)
} catch (e) {
console.error('[payload-debugger] Payload serialization would fail:', e)
const nonPOJOs = findNonPOJOs(nuxtApp.payload, 'payload')
if (nonPOJOs.length > 0) {
console.error('[payload-debugger] Non-POJO objects found in payload:')
for (const { path, type } of nonPOJOs) {
console.error(` - ${path}: ${type}`)
}
}
}
})
})