@remit/web-client 0.0.194 → 0.0.196

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/web-client",
3
- "version": "0.0.194",
3
+ "version": "0.0.196",
4
4
  "type": "module",
5
5
  "description": "Remit web client, published as composable primitives — the app shell, auth shells, and runtime config. A distributor imports what it composes and bundles it.",
6
6
  "exports": {
@@ -75,6 +75,7 @@
75
75
  "dependencies": {
76
76
  "@hookform/resolvers": "*",
77
77
  "@remit/api-http-client": "*",
78
+ "@remit/data-ports": "*",
78
79
  "@remit/domain-enums": "*",
79
80
  "@remit/ui": "*",
80
81
  "@tanstack/react-query": "^5",
@@ -64,6 +64,7 @@ i18n.use(initReactI18next).init({
64
64
 
65
65
  let container: HTMLElement;
66
66
  let root: Root;
67
+ let queryClient: QueryClient;
67
68
  const originalFetch = globalThis.fetch;
68
69
 
69
70
  interface FetchCall {
@@ -71,7 +72,7 @@ interface FetchCall {
71
72
  method: string;
72
73
  body: string;
73
74
  }
74
- type FetchRoute = (call: FetchCall) => Response;
75
+ type FetchRoute = (call: FetchCall) => Response | Promise<Response>;
75
76
  let route: FetchRoute = () => new Response("{}", { status: 200 });
76
77
 
77
78
  const json = (body: unknown): Response =>
@@ -80,6 +81,31 @@ const json = (body: unknown): Response =>
80
81
  headers: { "Content-Type": "application/json" },
81
82
  });
82
83
 
84
+ /**
85
+ * `GET /sync/status`, the read the empty-folder delete waits on. `lastSyncedAt`
86
+ * only advances once `POST /sync` has been answered, so a count read before the
87
+ * trigger is distinguishable from one a triggered round wrote.
88
+ */
89
+ const syncStatus = (
90
+ counts: Readonly<Record<string, number>>,
91
+ rounds: number,
92
+ ) => ({
93
+ accountId: "acc-1",
94
+ syncPhase: "complete",
95
+ mailboxes: mailboxes.map((box) => ({
96
+ mailboxId: box.mailboxId,
97
+ fullPath: box.fullPath,
98
+ phase: "complete",
99
+ messagesTotal: counts[box.mailboxId] ?? box.messageCount,
100
+ messagesSynced: 0,
101
+ lastSyncedAt: 1000 + rounds,
102
+ })),
103
+ });
104
+
105
+ const isSyncStatus = (url: string): boolean => url.includes("/sync/status");
106
+ const isSyncTrigger = (url: string, method: string): boolean =>
107
+ method === "POST" && url.endsWith("/sync");
108
+
83
109
  const threadItems = (ids: readonly string[]) => ({
84
110
  items: ids.map((id) => ({
85
111
  threadMessageId: `t-${id}`,
@@ -95,16 +121,22 @@ beforeEach(() => {
95
121
  container = document.createElement("div");
96
122
  document.body.appendChild(container);
97
123
  root = createRoot(container);
124
+ queryClient = new QueryClient({
125
+ defaultOptions: { queries: { retry: false }, mutations: { retry: false } },
126
+ });
98
127
  globalThis.fetch = (async (input: RequestInfo | URL) => {
99
128
  const request = input as Request;
100
129
  const body = request.method === "GET" ? "" : await request.clone().text();
101
- return route({ url: request.url, method: request.method, body });
130
+ return await route({ url: request.url, method: request.method, body });
102
131
  }) as typeof fetch;
103
132
  });
104
133
 
105
134
  afterEach(() => {
106
135
  act(() => root.unmount());
107
136
  container.remove();
137
+ // Drops the cached queries with their gc timers, which otherwise hold the
138
+ // test process open for their full gcTime.
139
+ queryClient.clear();
108
140
  globalThis.fetch = originalFetch;
109
141
  });
110
142
 
@@ -122,7 +154,7 @@ const render = (props: {
122
154
  { i18n },
123
155
  createElement(
124
156
  QueryClientProvider,
125
- { client: new QueryClient() },
157
+ { client: queryClient },
126
158
  createElement(DeleteFolderDialog, {
127
159
  open: props.open,
128
160
  accountId: "acc-1",
@@ -353,9 +385,17 @@ describe("DeleteFolderDialog", () => {
353
385
 
354
386
  it("deletes an empty folder and closes on success", async () => {
355
387
  let closed = false;
356
- route = ({ method }) => {
388
+ let rounds = 0;
389
+ let triggered = 0;
390
+ route = ({ url, method }) => {
357
391
  if (method === "DELETE") return new Response(null, { status: 204 });
358
- return new Response("{}", { status: 200 });
392
+ if (isSyncStatus(url)) return json(syncStatus({}, rounds));
393
+ if (isSyncTrigger(url, method)) {
394
+ triggered += 1;
395
+ rounds += 1;
396
+ return json({ triggered: true, message: "ok" });
397
+ }
398
+ return json({ items: mailboxes });
359
399
  };
360
400
  render({
361
401
  open: true,
@@ -368,9 +408,184 @@ describe("DeleteFolderDialog", () => {
368
408
  buttonByText(/^Delete folder$/)?.click();
369
409
  });
370
410
  await flush();
411
+ assert.equal(triggered, 1, "the delete asks the server for a sync round");
371
412
  assert.equal(closed, true);
372
413
  });
373
414
 
415
+ it("refuses to delete a folder the server says still holds mail", async () => {
416
+ let deleted = false;
417
+ let closed = false;
418
+ let rounds = 0;
419
+ route = ({ url, method }) => {
420
+ if (method === "DELETE") {
421
+ deleted = true;
422
+ return new Response(null, { status: 204 });
423
+ }
424
+ // Mail landed in Empty since its last sync round, so the count the
425
+ // round reports contradicts the zero the dialog opened on.
426
+ if (isSyncStatus(url)) return json(syncStatus({ empty: 2 }, rounds));
427
+ if (isSyncTrigger(url, method)) {
428
+ rounds += 1;
429
+ return json({ triggered: true, message: "ok" });
430
+ }
431
+ return json({ items: mailboxes });
432
+ };
433
+ render({
434
+ open: true,
435
+ folder: mailboxes[2] as RemitImapMailboxResponse,
436
+ onClose: () => {
437
+ closed = true;
438
+ },
439
+ });
440
+ assert.match(container.textContent ?? "", /empty and will be removed/);
441
+ await act(async () => {
442
+ buttonByText(/^Delete folder$/)?.click();
443
+ });
444
+ await flush();
445
+ assert.equal(deleted, false, "a fresh count above zero blocks the delete");
446
+ assert.equal(closed, false, "the dialog stays open on the mail it found");
447
+ assert.match(container.textContent ?? "", /This folder is not empty/);
448
+ assert.match(container.textContent ?? "", /reports 2 emails/);
449
+ assert.match(container.textContent ?? "", /holds 2 emails/);
450
+ assert.ok(
451
+ buttonByText(/Move them to another folder/),
452
+ "the non-empty flow takes over",
453
+ );
454
+ });
455
+
456
+ it("refuses the delete when the count cannot be read", async () => {
457
+ let deleted = false;
458
+ route = ({ url, method }) => {
459
+ if (method === "DELETE") {
460
+ deleted = true;
461
+ return new Response(null, { status: 204 });
462
+ }
463
+ if (isSyncStatus(url))
464
+ return new Response(JSON.stringify({ detail: "server exploded" }), {
465
+ status: 500,
466
+ headers: { "Content-Type": "application/json" },
467
+ });
468
+ if (isSyncTrigger(url, method))
469
+ return json({ triggered: true, message: "ok" });
470
+ return json({ items: mailboxes });
471
+ };
472
+ render({ open: true, folder: mailboxes[2] as RemitImapMailboxResponse });
473
+ await act(async () => {
474
+ buttonByText(/^Delete folder$/)?.click();
475
+ });
476
+ await flush();
477
+ assert.equal(deleted, false, "an unreadable count is not an empty folder");
478
+ assert.ok(
479
+ buttonByText(/^Close$/),
480
+ "the failure is stated, not swallowed into a delete",
481
+ );
482
+ });
483
+
484
+ it("does not delete when the dialog is closed mid-check", async () => {
485
+ let deleted = false;
486
+ let closed = false;
487
+ let rounds = 0;
488
+ let releaseStatus: (() => void) | undefined;
489
+ route = ({ url, method }) => {
490
+ if (method === "DELETE") {
491
+ deleted = true;
492
+ return new Response(null, { status: 204 });
493
+ }
494
+ if (isSyncStatus(url)) {
495
+ const answer = json(syncStatus({}, rounds));
496
+ if (rounds === 0) return answer;
497
+ // The round has landed but the answer is still in flight; the user
498
+ // gets to cancel before it arrives.
499
+ return new Promise<Response>((resolve) => {
500
+ releaseStatus = () => resolve(answer);
501
+ });
502
+ }
503
+ if (isSyncTrigger(url, method)) {
504
+ rounds += 1;
505
+ return json({ triggered: true, message: "ok" });
506
+ }
507
+ return json({ items: mailboxes });
508
+ };
509
+ render({
510
+ open: true,
511
+ folder: mailboxes[2] as RemitImapMailboxResponse,
512
+ onClose: () => {
513
+ closed = true;
514
+ },
515
+ });
516
+ await act(async () => {
517
+ buttonByText(/^Delete folder$/)?.click();
518
+ });
519
+ await flush();
520
+ assert.ok(releaseStatus, "the check is waiting on the server");
521
+ await act(async () => {
522
+ container
523
+ .querySelector<HTMLButtonElement>('button[aria-label="Cancel"]')
524
+ ?.click();
525
+ });
526
+ await act(async () => {
527
+ releaseStatus?.();
528
+ });
529
+ await flush();
530
+ assert.equal(closed, true, "the cancel closes the dialog");
531
+ assert.equal(deleted, false, "a cancelled check never reaches the delete");
532
+ });
533
+
534
+ it("asks whether to keep waiting, and resumes without a second round", async () => {
535
+ let deleted = false;
536
+ let reported = false;
537
+ let triggered = 0;
538
+ route = ({ url, method }) => {
539
+ if (method === "DELETE") {
540
+ deleted = true;
541
+ return new Response(null, { status: 204 });
542
+ }
543
+ if (isSyncStatus(url)) return json(syncStatus({}, reported ? 1 : 0));
544
+ if (isSyncTrigger(url, method)) {
545
+ triggered += 1;
546
+ return json({ triggered: true, message: "ok" });
547
+ }
548
+ return json({ items: mailboxes });
549
+ };
550
+ render({ open: true, folder: mailboxes[2] as RemitImapMailboxResponse });
551
+
552
+ // A sync fans the whole account out, so the folder's round can land long
553
+ // after the trigger. Run the clock forward instead of waiting on it.
554
+ const realNow = Date.now;
555
+ let fake = realNow();
556
+ // Past the segment in one step, so the stall is reached without a poll
557
+ // sleeping through it.
558
+ Date.now = () => {
559
+ fake += 200_000;
560
+ return fake;
561
+ };
562
+ try {
563
+ await act(async () => {
564
+ buttonByText(/^Delete folder$/)?.click();
565
+ });
566
+ await flush();
567
+ } finally {
568
+ Date.now = realNow;
569
+ // The reads taken under the fake clock cached a future timestamp, which
570
+ // reads as fresh once the real clock is back; drop them so the resumed
571
+ // wait talks to the server again.
572
+ queryClient.clear();
573
+ }
574
+
575
+ assert.equal(triggered, 1, "one round is asked for");
576
+ assert.equal(deleted, false, "an unreported folder is not deleted");
577
+ assert.match(container.textContent ?? "", /hasn't reported back/);
578
+ assert.ok(buttonByText(/^Keep waiting$/), "the wait is the user's call");
579
+
580
+ reported = true;
581
+ await act(async () => {
582
+ buttonByText(/^Keep waiting$/)?.click();
583
+ });
584
+ await flush();
585
+ assert.equal(triggered, 1, "resuming asks for no second round");
586
+ assert.equal(deleted, true, "the reported count settles the delete");
587
+ });
588
+
374
589
  it("moves the mail in batches then deletes the emptied folder", async () => {
375
590
  let closed = false;
376
591
  let moved: string[] = [];
@@ -14,7 +14,11 @@ import { useCallback, useEffect, useMemo, useState } from "react";
14
14
  import { useCreateMailbox } from "@/hooks/useCreateMailbox";
15
15
  import { useDeleteFolder } from "@/hooks/useDeleteFolder";
16
16
  import { useFolderLabelTranslator } from "@/hooks/useFolderLabelTranslator";
17
- import { initialStage, moveProgressLabel } from "@/lib/delete-folder";
17
+ import {
18
+ elapsedLabel,
19
+ initialStage,
20
+ moveProgressLabel,
21
+ } from "@/lib/delete-folder";
18
22
  import { buildMailboxRoleMap, labelForMailbox } from "@/lib/folder-roles";
19
23
  import { buildMoveOptions } from "@/lib/move-options";
20
24
 
@@ -37,11 +41,14 @@ const emailCount = (count: number): string =>
37
41
  `${count} ${count === 1 ? "email" : "emails"}`;
38
42
 
39
43
  /**
40
- * Per-folder delete wizard. An empty folder is a single destructive confirm; a
41
- * folder with mail first asks what happens to the messages delete them with
42
- * the folder, or move them elsewhere (batched, with visible progress) before
43
- * the now-empty folder is removed. Closing mid-move keeps already-moved mail
44
- * moved; re-opening enumerates what's left and continues.
44
+ * Per-folder delete wizard. An empty folder is a single destructive confirm,
45
+ * settled against a sync round asked for on the spot rather than the folder's
46
+ * last synced count a wait the user can watch, keep, or cancel, and which
47
+ * deletes nothing until the server answers; a folder with mail asks what
48
+ * happens to the messages first delete them with the folder, or move them
49
+ * elsewhere (batched, with visible progress) before the now-empty folder is
50
+ * removed. Closing mid-move keeps
51
+ * already-moved mail moved; re-opening enumerates what's left and continues.
45
52
  */
46
53
  export function DeleteFolderDialog({
47
54
  open,
@@ -54,6 +61,7 @@ export function DeleteFolderDialog({
54
61
  const [stage, setStage] = useState<FateStage>(() =>
55
62
  initialStage(folder.messageCount),
56
63
  );
64
+ const [arrivedSinceSync, setArrivedSinceSync] = useState<number>();
57
65
  const [destinationId, setDestinationId] = useState<string>();
58
66
  const { createFolderIn } = useCreateMailbox(accountId);
59
67
  const translator = useFolderLabelTranslator();
@@ -61,7 +69,9 @@ export function DeleteFolderDialog({
61
69
  phase,
62
70
  progress,
63
71
  errorMessage,
72
+ checkStartedAt,
64
73
  deleteMailbox,
74
+ deleteIfEmpty,
65
75
  moveThenDelete,
66
76
  cancel,
67
77
  reset,
@@ -70,12 +80,30 @@ export function DeleteFolderDialog({
70
80
  mailboxId: folder.mailboxId,
71
81
  onDeleted: onClose,
72
82
  });
83
+ const [checkElapsed, setCheckElapsed] = useState("0:00");
84
+
85
+ // The check has no progress to report — only that it is still waiting — so
86
+ // the wait itself is what the surface shows, ticking, for as long as it runs.
87
+ const waiting = phase === "checking" || phase === "check-stalled";
88
+ useEffect(() => {
89
+ if (!waiting || checkStartedAt === undefined) return;
90
+ const update = () =>
91
+ setCheckElapsed(elapsedLabel(Date.now() - checkStartedAt));
92
+ update();
93
+ const timer = setInterval(update, 1000);
94
+ return () => clearInterval(timer);
95
+ }, [waiting, checkStartedAt]);
73
96
 
97
+ // Opening the dialog stages it; a count arriving later deliberately does not.
98
+ // The refusal below invalidates the folder list on purpose, and re-staging on
99
+ // the count that refetch brings back would wipe the refusal off the screen.
100
+ // biome-ignore lint/correctness/useExhaustiveDependencies: folder.messageCount is read at open and must not re-run this.
74
101
  useEffect(() => {
75
102
  if (!open) return;
76
103
  setStage(initialStage(folder.messageCount));
104
+ setArrivedSinceSync(undefined);
77
105
  reset();
78
- }, [open, folder.messageCount, reset]);
106
+ }, [open, reset]);
79
107
 
80
108
  useEffect(() => {
81
109
  if (!open) return;
@@ -89,6 +117,13 @@ export function DeleteFolderDialog({
89
117
  onClose();
90
118
  }, [cancel, onClose]);
91
119
 
120
+ const handleDeleteEmpty = useCallback(async () => {
121
+ const outcome = await deleteIfEmpty();
122
+ if (outcome.status !== "blocked") return;
123
+ setArrivedSinceSync(outcome.messageCount);
124
+ setStage("choose-fate");
125
+ }, [deleteIfEmpty]);
126
+
92
127
  const destinations = useMemo<FolderTreeNode[]>(
93
128
  () =>
94
129
  buildMoveOptions({
@@ -117,6 +152,7 @@ export function DeleteFolderDialog({
117
152
  if (!open) return null;
118
153
 
119
154
  const title = `Delete ${name}`;
155
+ const messageCount = arrivedSinceSync ?? folder.messageCount;
120
156
 
121
157
  const body = (() => {
122
158
  if (phase === "moving") {
@@ -131,6 +167,42 @@ export function DeleteFolderDialog({
131
167
  );
132
168
  }
133
169
 
170
+ if (phase === "checking") {
171
+ return (
172
+ <div className="flex flex-col items-center gap-3 px-5 py-10 text-center">
173
+ <Loader2 className="size-8 animate-spin text-accent-2" />
174
+ <p className="text-sm font-medium text-fg">
175
+ Checking the folder on the mail server…
176
+ </p>
177
+ <p className="text-xs text-fg-muted" role="status" aria-live="polite">
178
+ {`Waiting ${checkElapsed}. Nothing is deleted until the server answers.`}
179
+ </p>
180
+ </div>
181
+ );
182
+ }
183
+
184
+ if (phase === "check-stalled") {
185
+ return (
186
+ <div className="space-y-4 px-5 py-4">
187
+ <Banner tone="warning" variant="soft">
188
+ {`The mail server hasn't reported back on this folder yet — ${checkElapsed} so far. Nothing has been deleted.`}
189
+ </Banner>
190
+ <p className="text-xs text-fg-muted">
191
+ A sync covers the whole account, so a busy mailbox can take a while
192
+ to come round to this folder.
193
+ </p>
194
+ <div className="flex justify-end gap-2">
195
+ <Button variant="secondary" size="sm" onClick={handleClose}>
196
+ Cancel
197
+ </Button>
198
+ <Button size="sm" onClick={() => handleDeleteEmpty()}>
199
+ Keep waiting
200
+ </Button>
201
+ </div>
202
+ </div>
203
+ );
204
+ }
205
+
134
206
  if (phase === "deleting" || phase === "done") {
135
207
  return (
136
208
  <div className="flex flex-col items-center gap-3 px-5 py-10 text-center">
@@ -178,7 +250,7 @@ export function DeleteFolderDialog({
178
250
  variant="danger"
179
251
  size="sm"
180
252
  icon={<Trash2 className="size-3.5" />}
181
- onClick={() => deleteMailbox()}
253
+ onClick={() => handleDeleteEmpty()}
182
254
  >
183
255
  Delete folder
184
256
  </Button>
@@ -191,9 +263,14 @@ export function DeleteFolderDialog({
191
263
  return (
192
264
  <>
193
265
  <div className="space-y-3 px-5 py-4 text-sm text-fg-muted">
266
+ {arrivedSinceSync !== undefined && (
267
+ <Banner tone="warning" variant="soft">
268
+ {`This folder is not empty: the mail server reports ${emailCount(arrivedSinceSync)} in it. Nothing was deleted.`}
269
+ </Banner>
270
+ )}
194
271
  <p>
195
272
  <strong className="text-fg">{name}</strong> holds{" "}
196
- {emailCount(folder.messageCount)}. What should happen to them?
273
+ {emailCount(messageCount)}. What should happen to them?
197
274
  </p>
198
275
  <div className="space-y-2">
199
276
  <button
@@ -244,8 +321,8 @@ export function DeleteFolderDialog({
244
321
  <div className="space-y-3 px-5 py-4 text-sm text-fg-muted">
245
322
  <p>
246
323
  Delete <strong className="text-fg">{name}</strong> and its{" "}
247
- {emailCount(folder.messageCount)}? The messages are removed from
248
- the server with the folder and can't be recovered.
324
+ {emailCount(messageCount)}? The messages are removed from the
325
+ server with the folder and can't be recovered.
249
326
  </p>
250
327
  </div>
251
328
  <footer className="flex items-center justify-end gap-2 border-t border-line px-5 py-3">
@@ -272,7 +349,7 @@ export function DeleteFolderDialog({
272
349
  return (
273
350
  <div className="flex h-[26rem] flex-col">
274
351
  <p className="px-5 pt-4 text-sm text-fg-muted">
275
- Move the {emailCount(folder.messageCount)} in{" "}
352
+ Move the {emailCount(messageCount)} in{" "}
276
353
  <strong className="text-fg">{name}</strong> to:
277
354
  </p>
278
355
  <div className="flex min-h-0 flex-1 overflow-hidden">
@@ -301,7 +378,7 @@ export function DeleteFolderDialog({
301
378
  className="h-11 w-full font-semibold"
302
379
  >
303
380
  <span className="truncate">
304
- {`Move ${emailCount(folder.messageCount)} to ${destination.label}`}
381
+ {`Move ${emailCount(messageCount)} to ${destination.label}`}
305
382
  </span>
306
383
  </Button>
307
384
  </footer>
@@ -3,6 +3,7 @@ import type {
3
3
  RemitImapAutoMovedInfo,
4
4
  RemitImapMessageSpamReport,
5
5
  } from "@remit/api-http-client/types.gen.ts";
6
+ import { mailboxLeafName } from "@remit/data-ports/mailbox-name";
6
7
  import { useQuery } from "@tanstack/react-query";
7
8
  import { useCallback } from "react";
8
9
  import {
@@ -11,7 +12,6 @@ import {
11
12
  resolveUndoTargetMailboxId,
12
13
  spamReportLabel,
13
14
  } from "@/lib/auto-moved";
14
- import { getMailboxDisplayName } from "@/lib/folder-roles";
15
15
  import { useInboxMailbox, useJunkMailbox } from "./useArchiveMailbox";
16
16
  import { useMoveMessages } from "./useMoveMessages";
17
17
  import { useReportSpam } from "./useReportSpam";
@@ -132,7 +132,7 @@ export const useAutoMovedBadge = ({
132
132
  const sourceFolderName = autoMoved.fromMailboxId
133
133
  ? mailboxes?.items
134
134
  .filter((mailbox) => mailbox.mailboxId === autoMoved.fromMailboxId)
135
- .map((mailbox) => getMailboxDisplayName(mailbox.fullPath))[0]
135
+ .map((mailbox) => mailboxLeafName(mailbox))[0]
136
136
  : undefined;
137
137
 
138
138
  return {
@@ -67,6 +67,7 @@ const mount = (
67
67
  mailboxId: `mbx-${body.fullPath}`,
68
68
  accountId: ACCOUNT,
69
69
  fullPath: body.fullPath,
70
+ hierarchyDelimiter: "/",
70
71
  syncStatus: createdSyncStatus,
71
72
  } as RemitImapMailboxResponse);
72
73
  return { mailboxId: `mbx-${body.fullPath}`, fullPath: body.fullPath };
@@ -173,6 +174,7 @@ describe("useCreateMailbox.createFolder validation", () => {
173
174
  mailboxId: `mbx-${body.fullPath}`,
174
175
  accountId: ACCOUNT,
175
176
  fullPath: body.fullPath,
177
+ hierarchyDelimiter: "/",
176
178
  } as RemitImapMailboxResponse);
177
179
  return { mailboxId: `mbx-${body.fullPath}`, fullPath: body.fullPath };
178
180
  }
@@ -3,10 +3,10 @@ import {
3
3
  mailboxOperationsListMailboxesOptions,
4
4
  mailboxOperationsListMailboxesQueryKey,
5
5
  } from "@remit/api-http-client/@tanstack/react-query.gen.ts";
6
+ import { mailboxLeafName } from "@remit/data-ports/mailbox-name";
6
7
  import type { FolderTreeNode } from "@remit/ui";
7
8
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
8
9
  import { useCallback, useRef } from "react";
9
- import { getMailboxDisplayName } from "@/lib/folder-roles";
10
10
  import { waitForMailboxSynced } from "@/lib/mailbox-sync-wait";
11
11
  import {
12
12
  composeFolderPath,
@@ -136,7 +136,7 @@ export function useCreateMailbox(accountId: string | undefined) {
136
136
  pendingByPath.current.delete(fullPath);
137
137
  return {
138
138
  id: confirmed.mailboxId,
139
- label: getMailboxDisplayName(confirmed.fullPath),
139
+ label: mailboxLeafName(confirmed),
140
140
  path: confirmed.fullPath,
141
141
  };
142
142
  },