@remit/web-client 0.0.124 → 0.0.125

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.124",
3
+ "version": "0.0.125",
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": {
@@ -58,7 +58,10 @@ interface BriefPaneContextValue {
58
58
  /** The conversation to open — the loaded thread, or a tapped "Related" hit. */
59
59
  conversation: ConversationTarget | undefined;
60
60
  onSelectMessage: (id: string, options?: OpenMessageOptions) => void;
61
- onSelectSearchResult: (result: SearchResult) => void;
61
+ onSelectSearchResult: (
62
+ result: SearchResult,
63
+ options?: OpenMessageOptions,
64
+ ) => void;
62
65
  onCloseThread: () => void;
63
66
  /**
64
67
  * Toolbar verbs for the open thread, keyed by the thread's own mailbox and
@@ -136,9 +139,10 @@ function BriefPaneProvider({ selectedMessageId, children }: BriefPaneProps) {
136
139
  );
137
140
 
138
141
  const handleSelectSearchResult = useCallback(
139
- (result: SearchResult) => {
142
+ (result: SearchResult, options?: OpenMessageOptions) => {
140
143
  navigate({
141
144
  to: "/mail",
145
+ replace: options?.replace,
142
146
  search: (prev) => ({
143
147
  ...prev,
144
148
  // Commit the active query with the selection so the debounced
@@ -373,7 +373,10 @@ interface DailyBriefProps {
373
373
  * Opens a search result. A semantic "Related" hit carries its thread + mailbox
374
374
  * so it opens even when its message isn't in the loaded brief list.
375
375
  */
376
- onSelectSearchResult?: (result: SearchResult) => void;
376
+ onSelectSearchResult?: (
377
+ result: SearchResult,
378
+ options?: OpenMessageOptions,
379
+ ) => void;
377
380
  /** Where the list publishes the commands the keyboard layer drives. */
378
381
  commandsRef?: RefObject<MessageListCommands | null>;
379
382
  /** Cursor / selection / display order, reported up to the triage layer. */
@@ -561,6 +564,29 @@ export function DailyBrief({
561
564
  [bodyRows],
562
565
  );
563
566
 
567
+ // A committed query puts rows the widened cross-folder search found into the
568
+ // body, and those messages are in folders the brief itself never loads. The
569
+ // reading pane resolves a bare `selectedMessageId` against the brief's own
570
+ // thread list, so such a row opens nothing; it goes through the search path
571
+ // instead, which carries the thread and mailbox the conversation is fetched
572
+ // by (#635).
573
+ const openRow = useCallback(
574
+ (id: string, options?: OpenMessageOptions) => {
575
+ const row = sq
576
+ ? bodyRows.find((candidate) => candidate.id === id)
577
+ : undefined;
578
+ if (row?.threadId && row.mailboxId && onSelectSearchResult) {
579
+ onSelectSearchResult(
580
+ rowToSearchResult(row, resultFolderIndex),
581
+ options,
582
+ );
583
+ return;
584
+ }
585
+ onSelectMessage?.(id, options);
586
+ },
587
+ [sq, bodyRows, resultFolderIndex, onSelectSearchResult, onSelectMessage],
588
+ );
589
+
564
590
  const accountSources = useMemo<FilterSheetSource[]>(() => {
565
591
  if (nonMuted.length <= 1) return [];
566
592
  return [
@@ -750,7 +776,7 @@ export function DailyBrief({
750
776
  briefCategory={selectedCategory}
751
777
  Row={MessageRow}
752
778
  selectedThreadId={selectedMessageId}
753
- onSelectThread={onSelectMessage}
779
+ onSelectThread={openRow}
754
780
  onSelectBriefCategory={setSelectedCategory}
755
781
  sources={accountSources}
756
782
  sourcesNote={mutedCount > 0 ? `+${mutedCount} muted` : undefined}
@@ -798,7 +824,7 @@ export function DailyBrief({
798
824
  <FilterPanelProvider hasSheet={showsRows && !searching}>
799
825
  <ThreadListInteraction
800
826
  selectedMessageId={selectedMessageId}
801
- onOpen={(id, options) => onSelectMessage?.(id, options)}
827
+ onOpen={openRow}
802
828
  onDeleteMessages={onDeleteMessages}
803
829
  onSelectionVerb={wizard.start}
804
830
  wizardOpen={wizard.isOpen}
package/src/lib/brief.ts CHANGED
@@ -56,6 +56,7 @@ export function toThreadRowData(
56
56
  id: thread.messageId,
57
57
  accountId: thread.accountId,
58
58
  mailboxId: thread.mailboxId,
59
+ threadId: thread.threadId,
59
60
  fromName: thread.fromName ?? thread.fromEmail ?? "Unknown",
60
61
  fromEmail: thread.fromEmail ?? "",
61
62
  subject: thread.subject ?? "(No subject)",
@@ -73,6 +73,7 @@ export function rowToSearchResult(
73
73
  date: row.timeLabel,
74
74
  unread: !row.isRead,
75
75
  flagged: row.starred === true,
76
+ ...(row.threadId ? { threadId: row.threadId } : {}),
76
77
  ...(row.mailboxId ? { mailboxId: row.mailboxId } : {}),
77
78
  ...(folder ? { folder } : {}),
78
79
  };