@remit/web-client 0.0.168 → 0.0.170
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.
|
|
3
|
+
"version": "0.0.170",
|
|
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": {
|
|
@@ -106,6 +106,7 @@
|
|
|
106
106
|
"@remit/drizzle-service": "*",
|
|
107
107
|
"@remit/electrodb-entities": "*",
|
|
108
108
|
"@remit/secrets-service": "*",
|
|
109
|
+
"@remit/test-dom": "*",
|
|
109
110
|
"@storybook/react-vite": "^9",
|
|
110
111
|
"@tailwindcss/vite": "^4",
|
|
111
112
|
"@tanstack/router-generator": "^1",
|
|
@@ -2,7 +2,7 @@ import { useNavigate, useRouterState, useSearch } from "@tanstack/react-router";
|
|
|
2
2
|
import { useEffect, useRef } from "react";
|
|
3
3
|
import { useMailContext } from "@/lib/mail-context";
|
|
4
4
|
import { shouldMirrorQuery } from "@/lib/search-view";
|
|
5
|
-
import { useIsComposing } from "@/routing";
|
|
5
|
+
import { useIsComposing, useIsReplying } from "@/routing";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* The list the mirror writes to. Each list calls the hook with its own route,
|
|
@@ -44,7 +44,9 @@ export type SearchMirrorTarget =
|
|
|
44
44
|
*
|
|
45
45
|
* A composer is not the pre-search list's leftover either. It is the reader's
|
|
46
46
|
* own unsent message, so a search started while it is up narrows the list
|
|
47
|
-
* behind it and leaves it standing.
|
|
47
|
+
* behind it and leaves it standing. A reply, a reply-all and a forward hold
|
|
48
|
+
* unsent text the same way and are spared the same way. Both are read off the
|
|
49
|
+
* path, so neither has to be kept in step with the surface that is showing.
|
|
48
50
|
*/
|
|
49
51
|
export function useSearchMirror(target: SearchMirrorTarget): void {
|
|
50
52
|
const navigate = useNavigate();
|
|
@@ -52,6 +54,8 @@ export function useSearchMirror(target: SearchMirrorTarget): void {
|
|
|
52
54
|
const { q: urlQuery = "" } = useSearch({ from: "/mail" });
|
|
53
55
|
const pathname = useRouterState({ select: (s) => s.location.pathname });
|
|
54
56
|
const isComposing = useIsComposing();
|
|
57
|
+
const isReplying = useIsReplying();
|
|
58
|
+
const isWriting = isComposing || isReplying;
|
|
55
59
|
|
|
56
60
|
// Read at effect time rather than depended on: the URL is what the mirror
|
|
57
61
|
// compares against, not what re-triggers it.
|
|
@@ -73,10 +77,10 @@ export function useSearchMirror(target: SearchMirrorTarget): void {
|
|
|
73
77
|
if (!mayWrite) return;
|
|
74
78
|
const queryGoesActive =
|
|
75
79
|
Boolean(committedQuery) && urlQueryRef.current !== committedQuery;
|
|
76
|
-
//
|
|
77
|
-
//
|
|
80
|
+
// A message being written is the reader's own, not a leftover of the list
|
|
81
|
+
// they were on, so a query going active narrows the list behind it and
|
|
78
82
|
// leaves it where it is.
|
|
79
|
-
const closesTheOpenSurface = queryGoesActive && !
|
|
83
|
+
const closesTheOpenSurface = queryGoesActive && !isWriting;
|
|
80
84
|
const search = (prev: Record<string, unknown>) => ({
|
|
81
85
|
...prev,
|
|
82
86
|
q: committedQuery || undefined,
|
|
@@ -107,6 +111,6 @@ export function useSearchMirror(target: SearchMirrorTarget): void {
|
|
|
107
111
|
mailboxId,
|
|
108
112
|
listPath,
|
|
109
113
|
pathname,
|
|
110
|
-
|
|
114
|
+
isWriting,
|
|
111
115
|
]);
|
|
112
116
|
}
|
package/src/test-support/dom.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Mount-and-poke harness over the jsdom globals
|
|
2
|
+
* Mount-and-poke harness over the jsdom globals `@remit/test-dom` installs.
|
|
3
3
|
*
|
|
4
4
|
* Excluded from coverage by `test:run`; it lives under `src/` only because the
|
|
5
5
|
* build's `rootDir` is `src/`. Node's test runner gives every test file its own
|