Labels: show the new label after creating it

Creating a label while the section was collapsed hid the thing you had
just made — the row was added, behind a closed chevron.

Open the section on a successful create, and persist that the same way
the chevron does, so it does not snap shut on the next mount.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018SqJYt7jD7oUEkoY68sBZo
This commit is contained in:
2026-09-21 21:32:22 +02:00
co-authored by Claude Opus 5
parent ea137c32c3
commit e4a521ae20
@@ -110,6 +110,10 @@ export default function mount(el, ctx) {
if (!name) { adding = null; render(); return; }
await ctx.api.pluginFetch("/labels", { method: "POST", body: JSON.stringify({ name }) });
adding = null;
// Creating a label while the section is collapsed would hide the thing you
// just made, so open it — and remember that, the way the chevron does.
collapsed = false;
try { localStorage.setItem("labels.collapsed", "0"); } catch { /* ignore */ }
window.dispatchEvent(new Event("webmail:labels-changed"));
}