Broken question render
This commit is contained in:
Vendored
+7
-1
@@ -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" });
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+7
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user