Public: anyone can read this; the crew can change it.

Trim the Talk page back under its 61,000-byte bound #17189

opened this

Merged 46h 23m ago, live in production

talk-trim → main 0 commits 1 thread · 1 unresolved

  • Merged. talk-trim was merged into main as 1bc140e.

Review

Sign in to review this change.
1 file changed +5 −7
src/web/pages/talk.ts +5 −7
@@ -508,9 +508,7 @@ function hereBar(ctx: Ctx, conversation: Conversation, context: Context | undefi
508508 return html`<header class="talk-head">
509509 <a class="btn talk-back" data-variant="ghost" href="${urlOf(conversation)}?chats=1" title="All your chats, newest first">${icon("comment")}Chats</a>
510510 <h2 class="talk-title">${nameOf(conversation)}${archived ? " (archived)" : ""}</h2>
511 ${picker}
512 ${tabs}
513 ${context !== undefined && context.share >= CONTEXT_SHOWN ? html`<span class="talk-fill small muted" title="${contextText(context)}">${meter(context.share * 100, contextText(context))} context used</span>` : null}
511 ${picker}${tabs}${context !== undefined && context.share >= CONTEXT_SHOWN ? html`<span class="talk-fill small muted" title="${contextText(context)}">${meter(context.share * 100, contextText(context))} context used</span>` : null}
514512 ${conversationMenu(ctx, conversation, context, display, null)}
515513 <form method="post" action="${HERE}/new">${iconBtn("plus", "New conversation", { variant: "ghost" })}</form>
516514 </header>`;
@@ -699,10 +697,10 @@ async function talkPage(ctx: Ctx, conversation: Conversation, before0: string |
699697 <div class="talk-base">
700698 ${dockBar(ctx, conversation, context, display, tabs, dockPicker)}
701699 <form class="talk-compose" id="compose" method="post" action="${buildMode ? "/talk/build" : editing === undefined ? here : `${here}/again/edit`}" ${editing === undefined ? null : html`data-edit`}${buildMode ? raw(" data-build") : null}>
702 ${conversation.archivedAt === null ? null : html`<p class="small muted" data-archived-note>Archived: sending here keeps it archived; Restore puts it back in the list.</p>`}
703 ${about}
704 ${editing === undefined && about !== null ? html`<input type="hidden" name="about" value="${ctx.url.searchParams.get("about")}" />` : null}
705 ${editing === undefined && !buildMode ? html`<input type="hidden" name="key" value="${last === "" ? "start" : last}" />` : null}
700 ${
701 // The rare lines (archived, about) share one source line, so their empty slots cost the
702 // page no bytes: it is held to a byte bound (test/talk-page.test.ts).

Nit, not blocking: a comment inside the interpolation, followed by four expressions on one line, is hard to read and easy to break. Hoist these four into a named const above the template (for example composeExtras) so the byte saving doesn't cost readability.

703 conversation.archivedAt === null ? null : html`<p class="small muted" data-archived-note>Archived: sending here keeps it archived; Restore puts it back in the list.</p>`}${about}${editing === undefined && about !== null ? html`<input type="hidden" name="about" value="${ctx.url.searchParams.get("about")}" />` : null}${editing === undefined && !buildMode ? html`<input type="hidden" name="key" value="${last === "" ? "start" : last}" />` : null}
706704 ${chosen === undefined ? null : html`<input type="hidden" name="template" value="${chosen}" />`}
707705 ${confirmsDock(pendingConfirms)}
708706 <p class="sr-only" role="status" data-confirms-said></p>

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs