fix: prevent crash rendering website files without a workers array in Dashboard Files

TabFiles.renderItem accessed `file.workers.length` unguarded when deciding
whether to show the website badge. Directory entries that have a published
website but no `workers` array (the common case) made this throw
`Cannot read properties of undefined (reading 'length')`, so the row failed
to render — the file silently disappeared from the list (swallowed by the
Promise.allSettled batch) or was never added on socket-driven updates.

The sibling `is_worker` derivation on the same entry already guards with
`file.workers?.length`, and the desktop reference (UIItem.js) normalizes
`workers` to an array and shows the badge via `!is_worker`. Reuse the safe
`is_worker` flag here instead of touching `file.workers.length` directly.
This commit is contained in:
jelveh
2026-07-16 19:50:36 -07:00
parent 75d3b07e0f
commit 40d717e4df
+3 -3
View File
@@ -2050,9 +2050,9 @@ const TabFiles = {
${icon}
</div>
<div class="item-badges">
<img class="item-badge item-has-website-badge long-hover"
style="${file.has_website && file.workers.length === 0 ? 'display:block;' : ''}"
src="${html_encode(window.icons['world.svg'])}"
<img class="item-badge item-has-website-badge long-hover"
style="${file.has_website && !is_worker ? 'display:block;' : ''}"
src="${html_encode(window.icons['world.svg'])}"
data-item-id="${item_id}"
/>
<img class="item-badge item-has-website-url-badge"