Broken question render

This commit is contained in:
Ian Gulliver
2026-10-15 22:00:12 -07:00
parent 4540a63901
commit e0b051c6c7
3 changed files with 15 additions and 3 deletions
+7 -1
View File
@@ -13,6 +13,7 @@ export function mountInbox(root) {
const cards = new Map();
const nothing = h("div", { class: "empty" }, "Nothing waiting on you in this task.");
const noTask = h("div", { class: "empty" }, "No task selected.");
let shown;
const render = () => {
const taskId = state.selectedTaskId;
const items = state.inbox.filter((i) => i.task_id === taskId).sort((a, b) => a.created_at.localeCompare(b.created_at));
@@ -43,7 +44,12 @@ export function mountInbox(root) {
reconcile(list, [noTask]);
return;
}
reconcile(list, items.length > 0 ? [cardFor(items[0])] : [nothing]);
const top = items[0]?.id;
reconcile(list, top ? [cardFor(items[0])] : [nothing]);
if (top !== shown) {
shown = top;
list.scrollTop = 0;
}
};
const off = onEach(["inbox", "selection"], render);
const changes = h("section", { class: "inbox-changes" });
+1 -1
View File
File diff suppressed because one or more lines are too long
+7 -1
View File
@@ -15,6 +15,7 @@ export function mountInbox(root: HTMLElement): () => void {
const cards = new Map<string, { sig: string; el: HTMLElement }>();
const nothing = h("div", { class: "empty" }, "Nothing waiting on you in this task.");
const noTask = h("div", { class: "empty" }, "No task selected.");
let shown: string | undefined;
const render = () => {
const taskId = state.selectedTaskId;
@@ -48,7 +49,12 @@ export function mountInbox(root: HTMLElement): () => void {
reconcile(list, [noTask]);
return;
}
reconcile(list, items.length > 0 ? [cardFor(items[0]!)] : [nothing]);
const top = items[0]?.id;
reconcile(list, top ? [cardFor(items[0]!)] : [nothing]);
if (top !== shown) {
shown = top;
list.scrollTop = 0;
}
};
const off = onEach(["inbox", "selection"], render);