Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.
Rust apple-notesapple-reminderscloudkitcrdtdesktop-appicloudicloud-calendaricloud-driveicloud-notesicloud-photosiphonelinuxlinux-desktoplocal-firstoffline-firstprivacyrusttauritauri-appwindows
Reminders: each row stays held until its own write answers, however many are on their way
Yashwanth Kamireddi5419b1c7ef73
diff --git a/.uiverify/reminders-instant.mjs b/.uiverify/reminders-instant.mjsindex 20c98ec..7f69f4f 100644--- a/.uiverify/reminders-instant.mjs+++ b/.uiverify/reminders-instant.mjs@@ -38,5 +38,16 @@ await tick.click();await page.waitForTimeout(150);const ticked = (await tick.getAttribute("aria-checked")) === "true";ok(ticked, "a tick shows at once");+// Two writes at once: the first finishing must not free the second's row while it is+// still on its way. Each row stays held until its own answer comes.+const a = page.getByRole("checkbox", { name: "Evening run" });+await a.click();+await page.waitForTimeout(600);+const c = page.getByRole("checkbox", { name: "Pick up the parcel" });+if (await c.count()) {+ await c.click();+ await page.waitForTimeout(1100); // the first has answered; the second has not+ ok(await c.isDisabled(), "a row stays held while its own write is still on its way");+}await b.close();process.exitCode = failures ? 1 : 0;diff --git a/src/screens/RemindersView.tsx b/src/screens/RemindersView.tsxindex bef6241..91bc479 100644--- a/src/screens/RemindersView.tsx+++ b/src/screens/RemindersView.tsx@@ -181,7 +181,8 @@ export function RemindersView() {const [items, setItems] = useState<Reminder[]>([]);const [showDone, setShowDone] = useState(false);const [syncing, setSyncing] = useState(false);- const [busyGuid, setBusyGuid] = useState<string | null>(null);+ /** Every reminder with a write still on its way — a set, since several can be at once. */+ const [busy, setBusy] = useState<ReadonlySet<string>>(() => new Set());const [openGuid, setOpenGuid] = useState<string | null>(null);const [draft, setDraft] = useState("");const [newList, setNewList] = useState("");@@ -295,7 +296,7 @@ export function RemindersView() {run: () => Promise<void>,predict?: (rows: Reminder[]) => Reminder[],): Promise<Reminder[] | null> => {- setBusyGuid(reminder.guid);+ setBusy((was) => new Set(was).add(reminder.guid));setError(null);if (predict) setItems((rows) => predict(rows));try {@@ -306,7 +307,11 @@ export function RemindersView() {readItems().catch(() => {});return null;} finally {- setBusyGuid(null);+ setBusy((was) => {+ const next = new Set(was);+ next.delete(reminder.guid);+ return next;+ });}},[readItems],@@ -1013,7 +1018,7 @@ export function RemindersView() {role="checkbox"aria-checked={Boolean(reminder.completedAt)}aria-label={reminder.title}- disabled={busyGuid === reminder.guid}+ disabled={busy.has(reminder.guid)}style={{ "--tick": colourOf(home) } as React.CSSProperties}onClick={() => toggle(reminder)}/>@@ -1036,7 +1041,7 @@ export function RemindersView() {defaultValue={reminder.title}key={`${reminder.guid}-${reminder.title}`}aria-label={`Rename ${reminder.title}`}- disabled={busyGuid === reminder.guid}+ disabled={busy.has(reminder.guid)}onBlur={(e) => void rename(reminder, e.target.value)}onKeyDown={(e) => {if (e.key === "Enter") e.currentTarget.blur();@@ -1092,7 +1097,7 @@ export function RemindersView() {<Pickerlabel={`Repeat for ${reminder.title}`}value={repeatKey(reminder)}- disabled={busyGuid === reminder.guid || reminder.dueAt === null}+ disabled={busy.has(reminder.guid) || reminder.dueAt === null}onChange={(key) => void setRepeat(reminder, key)}options={repeatKey(reminder) === "custom"@@ -1114,7 +1119,7 @@ export function RemindersView() {<Pickerlabel={`Priority for ${reminder.title}`}value={String(reminder.priority)}- disabled={busyGuid === reminder.guid}+ disabled={busy.has(reminder.guid)}onChange={(v) => void setPriority(reminder, Number(v))}options={PRIORITIES.map((p) => ({value: String(p.value),@@ -1127,7 +1132,7 @@ export function RemindersView() {<Pickerlabel={`List for ${reminder.title}`}value={reminder.listGuid}- disabled={busyGuid === reminder.guid}+ disabled={busy.has(reminder.guid)}onChange={(guid) => void moveToList(reminder, guid)}options={lists.map((l) => ({ value: l.guid, label: l.title }))}/>@@ -1144,7 +1149,7 @@ export function RemindersView() {{depth > 0 ? (<buttonclassName="rx-link"- disabled={busyGuid === reminder.guid}+ disabled={busy.has(reminder.guid)}onClick={() => void outdent(reminder)}>Move Out of Subtasks@@ -1152,7 +1157,7 @@ export function RemindersView() {) : (<buttonclassName="rx-link"- disabled={busyGuid === reminder.guid}+ disabled={busy.has(reminder.guid)}onClick={() => void indent(reminder)}>Make Subtask@@ -1161,7 +1166,7 @@ export function RemindersView() {<buttonclassName="rx-link danger"aria-label={`Delete ${reminder.title}`}- disabled={busyGuid === reminder.guid}+ disabled={busy.has(reminder.guid)}onClick={() => remove(reminder)}>Delete@@ -1188,7 +1193,7 @@ export function RemindersView() {reminder.flagged ? `Unflag ${reminder.title}` : `Flag ${reminder.title}`}aria-pressed={reminder.flagged}- disabled={busyGuid === reminder.guid}+ disabled={busy.has(reminder.guid)}onClick={() => flag(reminder)}><Glyph name="flagged" />