You've already forked AstralRinth
forked from didirus/AstralRinth
fix: conditionally fetch (#5157)
* fix: conditionally fetch * fix: yeet
This commit is contained in:
@@ -754,9 +754,10 @@ const route = useNativeRoute()
|
|||||||
const router = useNativeRouter()
|
const router = useNativeRouter()
|
||||||
const link = config.public.siteUrl + route.path.replace(/\/+$/, '')
|
const link = config.public.siteUrl + route.path.replace(/\/+$/, '')
|
||||||
|
|
||||||
const { data: payoutBalance } = await useAsyncData('payout/balance', () =>
|
const { data: payoutBalance } = await useAsyncData('payout/balance', () => {
|
||||||
useBaseFetch('payout/balance', { apiVersion: 3 }),
|
if (!auth.value.user) return null
|
||||||
)
|
return useBaseFetch('payout/balance', { apiVersion: 3 })
|
||||||
|
})
|
||||||
|
|
||||||
const showTaxComplianceBanner = computed(() => {
|
const showTaxComplianceBanner = computed(() => {
|
||||||
if (flags.value.testTaxForm && auth.value.user) return true
|
if (flags.value.testTaxForm && auth.value.user) return true
|
||||||
|
|||||||
@@ -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)
|
|
||||||
})
|
|
||||||
@@ -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}`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
Reference in New Issue
Block a user