Commit 9ad7272
[Plugin] INC-12: row counts, designed empty states, Clear filters
Every list says how many, and a filter narrowed to nothing says so and
offers the way back — Orders, Pricing & inventory and Coupons.
THE INTRO LINE CARRIES THE COUNT, pluralized through `Intl.PluralRules`
on the console's one pinned locale (the constant the date dialect
already uses), so `1 order` / `17 orders` come from one place.
AND IT IS HONEST ABOUT WHAT IT COUNTED. Every list port answers
`{items, nextCursor}` and no screen has a total, so `17 orders` renders
only when the page IS the set — first page of its filter, no next
cursor. Everywhere else the same count reads `25 orders on this page`.
Page 3 of 3 knows nothing about pages 1 and 2 (keyset paging carries no
running offset and the scaffold does not accumulate one across
stateless interactions), so it stays page-scoped too. A whole-store
total needs the service to return one; a number an operator would
reconcile against is not invented in a renderer.
ZERO RENDERS NO COUNT — never `0 orders`. The state below says it in
words, and a count line repeating it is "unknown rendered as 0".
TWO ZERO STATES THAT NO LONGER READ ALIKE. An empty collection is not
the operator's doing and is not addressed as though it were. A filter
narrowed to nothing is a different event and now gets a heading, body
copy and a `Clear filters` button where it used to get one line of
`empty_text` under a table that was not rendered. The undo is attached
to the state that needs it and to no other.
THE WHOLE-COLLECTION WORDING IS GATED ON `firstPage`, exactly as the
count is. "No orders yet" is a claim about the collection and page 2 of
a scan has no standing to make one — page 1 had rows. Reachable in a
live store, not only in theory: the look-ahead read that minted the
cursor and the read that follows it straddle a concurrent delete, and
the second comes back empty. A non-first-page zero falls through to
page-scoped wording, offering nothing to click since nothing was
filtered.
`Clear filters` IS ONE ACT WITH ONE BUILDER — ACROSS THE THREE SCREENS
THIS TOUCHES. The summary section's accessory and the new zero-state
button come from one builder, so the label, the verb and the payload
cannot drift on Orders, Pricing & inventory and Coupons. tax-page.ts
and shipping-page.ts still hand-roll a byte-identical button and are
deliberately untouched here (one PR, one thing) — they are the
next-touch consolidation onto `clearFiltersButton`. The builder fires a
BARE apply-filter (no values ⇒ the level's default filter) and carries
the drill path in the button's own `value`, which keeps the re-render
on the level the operator was standing on.
A PAGE WITH ANOTHER PAGE BEHIND IT NEVER CLAIMS TO BE THE END. The
pinned renderer collapses a zero-row table carrying `empty_text` to a
bare <p> and takes "Load more" with it, so a mid-scan zero page keeps a
headers-only table plus a note. Established for the low-stock filter;
now the shared rule for every screen.
BUILT ONCE: `listResult` in `scaffold/list-detail.ts` decides which
outcome a render is in and the three screens supply wording only. The
list level's `render` also receives `firstPage`, the one fact neither
the honest-count rule nor the whole-collection gate can be derived
without.
TWO CONTAINMENT FIXES CARRIED ALONG. A cursor minted before the
products filter grew its page-context wrapper arrived as a bare filter
form and threw on the way into `render`; it now self-heals — the bare
shape IS the form, so the operator's filter survives the deploy, and an
unreadable one degrades to "no filter set" rather than to an exception
(G5). And the cursor encoding is documented for what it carries:
`fetchPage` and `render` share one filter object, so page context
written during the fetch rides the next-page cursor too.
Gate: full run green at the pre-review tree (180 files, 3179 tests,
SQLite). Review take-its re-gated delta-scoped — lint, typecheck,
format:check, and the three page suites plus four scaffold suites
(7 files, 342 tests) all green.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uq2ju7XBMf2rJsXBxSjE741 parent b917755 commit 9ad7272
9 files changed
Lines changed: 975 additions & 146 deletions
File tree
- .changeset
- packages/plugin
- src/admin
- scaffold
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | | - | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
| |||
372 | 374 | | |
373 | 375 | | |
374 | 376 | | |
375 | | - | |
376 | | - | |
| 377 | + | |
| 378 | + | |
377 | 379 | | |
378 | 380 | | |
379 | 381 | | |
380 | 382 | | |
381 | 383 | | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
382 | 389 | | |
383 | 390 | | |
384 | 391 | | |
| |||
407 | 414 | | |
408 | 415 | | |
409 | 416 | | |
| 417 | + | |
410 | 418 | | |
411 | 419 | | |
412 | 420 | | |
413 | 421 | | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
414 | 450 | | |
415 | 451 | | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
| 452 | + | |
421 | 453 | | |
422 | 454 | | |
423 | 455 | | |
424 | 456 | | |
425 | | - | |
426 | | - | |
427 | 457 | | |
428 | 458 | | |
429 | 459 | | |
| |||
433 | 463 | | |
434 | 464 | | |
435 | 465 | | |
436 | | - | |
437 | 466 | | |
438 | 467 | | |
439 | 468 | | |
440 | 469 | | |
441 | 470 | | |
442 | 471 | | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
| 472 | + | |
449 | 473 | | |
450 | 474 | | |
451 | 475 | | |
452 | 476 | | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
468 | 482 | | |
469 | | - | |
| 483 | + | |
| 484 | + | |
470 | 485 | | |
471 | 486 | | |
472 | 487 | | |
| |||
541 | 556 | | |
542 | 557 | | |
543 | 558 | | |
544 | | - | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
545 | 564 | | |
546 | 565 | | |
547 | 566 | | |
| |||
569 | 588 | | |
570 | 589 | | |
571 | 590 | | |
572 | | - | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
573 | 595 | | |
574 | 596 | | |
575 | 597 | | |
| |||
0 commit comments