Skip to content

Commit 31cd208

Browse files
harlan-zwclaude
andauthored
fix(devtools): add null safety (#501)
Co-authored-by: Claude <[email protected]>
1 parent c9e1a20 commit 31cd208

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

client/app.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ const scriptSizes = reactive<Record<string, string>>({})
1111
const scriptErrors = reactive<Record<string, string>>({})
1212
1313
function syncScripts(_scripts: any[]) {
14+
if (!_scripts || typeof _scripts !== 'object') {
15+
scripts.value = {}
16+
return
17+
}
1418
// augment the scripts with registry
1519
scripts.value = Object.fromEntries(
1620
Object.entries({ ..._scripts })
@@ -59,7 +63,7 @@ onDevtoolsClientConnected(async (client) => {
5963
syncScripts(ctx.scripts)
6064
})
6165
version.value = client.host.nuxt.$config.public['nuxt-scripts'].version
62-
syncScripts(client.host.nuxt._scripts)
66+
syncScripts(client.host.nuxt._scripts || {})
6367
})
6468
const tab = ref('scripts')
6569

0 commit comments

Comments
 (0)