Skip to content

Commit 8941aa1

Browse files
elemdosclaude
andcommitted
fix: add null-safety for assets array in FileField component
Prevents crash when uploading images in Content panel on projects where updated.assets may be null/undefined. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 4ad9759 commit 8941aa1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/routes/tinykit/studio/components/FileField.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
5858
// Upload files
5959
const updated = await pb.collection("_tk_projects").update(project_id, form)
60-
const new_assets = (updated.assets as string[]).slice(before_count)
60+
const new_assets = (updated.assets as string[] || []).slice(before_count)
6161
6262
if (multiple) {
6363
const current = Array.isArray(value) ? value : value ? [value] : []

0 commit comments

Comments
 (0)