@remit/ui 0.0.189 → 0.0.190

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/ui",
3
- "version": "0.0.189",
3
+ "version": "0.0.190",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src"
@@ -922,6 +922,9 @@ export const ChipGallery: ChipStory = {
922
922
  <div className="space-y-2">
923
923
  <FilterPreviewCount preview={{ status: "loading" }} />
924
924
  <FilterPreviewCount preview={READY(0)} />
925
+ <FilterPreviewCount
926
+ preview={{ status: "ready", count: 0, indexEmpty: true }}
927
+ />
925
928
  <FilterPreviewCount preview={READY(412)} />
926
929
  <FilterPreviewCount preview={READY(47, true)} />
927
930
  <FilterPreviewCount
@@ -431,6 +431,20 @@ describe("FilterPreviewCount", () => {
431
431
  assert.doesNotMatch(html, /role="alert"/);
432
432
  });
433
433
 
434
+ // A zero counted against an index that holds nothing is not the same
435
+ // statement as a zero counted against the mail (#452), and reading it as one
436
+ // talks the user out of a rule that would match plenty.
437
+ it("says the index is still filling rather than that nothing matches", () => {
438
+ const html = render(
439
+ createElement(FilterPreviewCount, {
440
+ preview: { status: "ready", count: 0, indexEmpty: true },
441
+ }),
442
+ );
443
+ assert.match(html, /Still indexing/);
444
+ assert.doesNotMatch(html, /No mail matches yet/);
445
+ assert.doesNotMatch(html, /role="alert"/);
446
+ });
447
+
434
448
  it("counts many matches", () => {
435
449
  const html = render(
436
450
  createElement(FilterPreviewCount, {
@@ -116,10 +116,15 @@ export interface LabelOption {
116
116
  * The live match count (RFC 038 D1). `stale` marks a count the editor already
117
117
  * moved past — a clause changed after it was counted, so the number on screen
118
118
  * is the previous rule's until the next preview lands.
119
+ *
120
+ * `indexEmpty` is the server saying the semantic index had nothing to answer
121
+ * with (issue #452). A zero counted against an empty index is a fact about the
122
+ * index, not about the rule, and reading it as "no mail matches" talks a user
123
+ * out of a rule that will match plenty once indexing catches up.
119
124
  */
120
125
  export type PreviewCount =
121
126
  | { status: "loading" }
122
- | { status: "ready"; count: number; stale?: boolean }
127
+ | { status: "ready"; count: number; stale?: boolean; indexEmpty?: boolean }
123
128
  | { status: "error"; reason: string };
124
129
 
125
130
  const clauseFieldLabels: Record<ClauseField, string> = {
@@ -225,7 +230,10 @@ export function matchJoinWord(operator: MatchOperator): string {
225
230
  export function previewCountSummary(preview: PreviewCount): string {
226
231
  if (preview.status === "loading") return "Counting matches…";
227
232
  if (preview.status === "error") return preview.reason;
228
- if (preview.count === 0) return "No mail matches yet";
233
+ if (preview.count === 0)
234
+ return preview.indexEmpty
235
+ ? "Still indexing — nothing to match against yet"
236
+ : "No mail matches yet";
229
237
  const noun = preview.count === 1 ? "message" : "messages";
230
238
  const base = `${preview.count} ${noun} match`;
231
239
  return preview.stale ? `${base} — recounting` : base;