From 1abb413cf1fae1b7f0f91f2c32c9e5fdfd749677 Mon Sep 17 00:00:00 2001 From: "Calum H." Date: Fri, 16 Jan 2026 10:38:07 +0000 Subject: [PATCH 1/3] feat: non-POJO check in rendered hook Signed-off-by: Calum H. --- apps/frontend/nuxt.config.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/apps/frontend/nuxt.config.ts b/apps/frontend/nuxt.config.ts index 93afe78c50..9a9a067443 100644 --- a/apps/frontend/nuxt.config.ts +++ b/apps/frontend/nuxt.config.ts @@ -175,6 +175,20 @@ export default defineNuxtConfig({ await fs.writeFile('./src/public/robots.txt', robotsContent) }, + 'app:rendered': (ctx) => { + if (ctx.ssrContext?.payload?.data) { + const check = (obj: any, path = 'payload') => { + if (!obj || typeof obj !== 'object') return + if (obj.constructor && obj.constructor.name !== 'Object' && obj.constructor.name !== 'Array') { + console.error(`Non-POJO at ${path}:`, obj.constructor.name) + } + for (const [k, v] of Object.entries(obj)) { + check(v, `${path}.${k}`) + } + } + check(ctx.ssrContext.payload.data) + } + } }, runtimeConfig: { // @ts-ignore From 69fb3d76d4a4dcb559975d4e7c418e911ec7751e Mon Sep 17 00:00:00 2001 From: "Calum H. (IMB11)" Date: Fri, 16 Jan 2026 19:45:55 +0000 Subject: [PATCH 2/3] fix: lint --- apps/frontend/nuxt.config.ts | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/apps/frontend/nuxt.config.ts b/apps/frontend/nuxt.config.ts index 9a9a067443..bcb002b534 100644 --- a/apps/frontend/nuxt.config.ts +++ b/apps/frontend/nuxt.config.ts @@ -176,19 +176,23 @@ export default defineNuxtConfig({ await fs.writeFile('./src/public/robots.txt', robotsContent) }, 'app:rendered': (ctx) => { - if (ctx.ssrContext?.payload?.data) { - const check = (obj: any, path = 'payload') => { - if (!obj || typeof obj !== 'object') return - if (obj.constructor && obj.constructor.name !== 'Object' && obj.constructor.name !== 'Array') { - console.error(`Non-POJO at ${path}:`, obj.constructor.name) - } - for (const [k, v] of Object.entries(obj)) { - check(v, `${path}.${k}`) - } - } - check(ctx.ssrContext.payload.data) - } - } + if (ctx.ssrContext?.payload?.data) { + const check = (obj: any, path = 'payload') => { + if (!obj || typeof obj !== 'object') return + if ( + obj.constructor && + obj.constructor.name !== 'Object' && + obj.constructor.name !== 'Array' + ) { + console.error(`Non-POJO at ${path}:`, obj.constructor.name) + } + for (const [k, v] of Object.entries(obj)) { + check(v, `${path}.${k}`) + } + } + check(ctx.ssrContext.payload.data) + } + }, }, runtimeConfig: { // @ts-ignore From 00260a014a61dd9ea5634cfc2023948f1c3edf3b Mon Sep 17 00:00:00 2001 From: "Calum H. (IMB11)" Date: Fri, 16 Jan 2026 19:50:26 +0000 Subject: [PATCH 3/3] move to plugin --- apps/frontend/nuxt.config.ts | 18 ------------------ apps/frontend/src/plugins/debug-pojo.ts | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 18 deletions(-) create mode 100644 apps/frontend/src/plugins/debug-pojo.ts diff --git a/apps/frontend/nuxt.config.ts b/apps/frontend/nuxt.config.ts index bcb002b534..93afe78c50 100644 --- a/apps/frontend/nuxt.config.ts +++ b/apps/frontend/nuxt.config.ts @@ -175,24 +175,6 @@ export default defineNuxtConfig({ await fs.writeFile('./src/public/robots.txt', robotsContent) }, - 'app:rendered': (ctx) => { - if (ctx.ssrContext?.payload?.data) { - const check = (obj: any, path = 'payload') => { - if (!obj || typeof obj !== 'object') return - if ( - obj.constructor && - obj.constructor.name !== 'Object' && - obj.constructor.name !== 'Array' - ) { - console.error(`Non-POJO at ${path}:`, obj.constructor.name) - } - for (const [k, v] of Object.entries(obj)) { - check(v, `${path}.${k}`) - } - } - check(ctx.ssrContext.payload.data) - } - }, }, runtimeConfig: { // @ts-ignore diff --git a/apps/frontend/src/plugins/debug-pojo.ts b/apps/frontend/src/plugins/debug-pojo.ts new file mode 100644 index 0000000000..e9fe18c7d7 --- /dev/null +++ b/apps/frontend/src/plugins/debug-pojo.ts @@ -0,0 +1,24 @@ +import { defineNuxtPlugin } from '#imports' + +export default defineNuxtPlugin((nuxt) => { + if (import.meta.server) { + nuxt.hooks.hook('app:rendered', (ctx) => { + if (ctx.ssrContext?.payload?.data) { + const check = (obj: any, path = 'payload') => { + if (!obj || typeof obj !== 'object') return + if ( + obj.constructor && + obj.constructor.name !== 'Object' && + obj.constructor.name !== 'Array' + ) { + console.error(`Non-POJO at ${path}:`, obj.constructor.name) + } + for (const [k, v] of Object.entries(obj)) { + check(v, `${path}.${k}`) + } + } + check(ctx.ssrContext.payload.data) + } + }) + } +})