Repository navigation
feat(notification-bell): controllable open state, independent unread count, and lazy loading - #412
Nitjsefnie wants to merge 4 commits into
Conversation
|
Heads-up: this branch lives in an organization-owned fork, and GitHub doesn't let maintainers push to those. If anything needs changing, just say so here and I'll make the change on this branch right away. |
|
Reviewed against |
a35a9d0 to
8a3a509
Compare
|
Rebased onto current main ( |
|
Thanks @Nitjsefnie! Landing this now: I'm rebasing your branch on main (30+ commits behind), regenerating the generated files and running |
|
Correction: I can't push to your fork (403), so I haven't changed your branch. Your 32 NotificationBell tests pass, and |
|
Will do: rebasing |
8a3a509 to
85cad30
Compare
|
Pushed: |
|
Hi @Nitjsefnie, we're preparing the 4.6.0 release. This PR is ~120 commits behind main and we can't push to your fork. If you rebase on main this week we'll land it in 4.6 (tests already passed on your head). Otherwise it goes into the next release, no problem. |
Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
Co-Authored-By: GLM-5.3-Flash <noreply@z.ai>
Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
85cad30 to
849fa50
Compare
|
Pushed: rebased onto |
Closes #380
Regression test (written first)
main:Nineteen new behavior tests failed on the unmodified component (assertion/DOM failures,
each naming a missing prop's effect: count override ignored, no
bind:open, no loadingstate), while the explicit legacy control and the seven original tests passed. After the
implementation landed, review found one more acceptance gap on the newly exposed
parent-close path, and its regression test failed before the fix:
Root cause and fix
NotificationBellowned its open state privately and derived the unread count from theloaded list, so a consumer could not lazy-load the list while keeping the count fresh, and
the page could not observe opens/closes. This adds three additive props, following the
existing
Popovercontrollable-state idiom (open = $bindable(false), guardedsetOpen, user-onlyonOpenChange,close(restoreFocus)):bind:open+onOpenChange— panel state is controllable and observable. Aparent-driven close returns focus to the trigger when focus was inside the panel
(a pre-effect before the closing DOM update; Escape and outside-click behavior are
unchanged); closing via Escape still restores trigger focus; outside presses keep the
outside target's focus, matching
Popover.count— overrides the list-derived unread count (??fallback, so an explicit0wins); the trigger name, badge and mark-all visibility share it. Count changes announce
through the shared polite announcer (initial render stays silent).
loading(+labels.loading, en + pt-BR messages) — while loading with an empty listthe definitive empty state is suppressed; any loaded list is retained.
Additive only:
notifications,onRead,onReadAll,onClear, classes and the existingtranslated name format are unchanged. Note the issue's example names (
items,onSelect,onMarkAllRead) differ from the real API (notifications,onRead,onReadAll); the real names were kept and no aliases added.Tests: a new state matrix (
NotificationBellState.svelte.test.ts+ harness) coversparent-set vs user-clicked open × explicit/derived count × loading × populated/empty list
(16 combinations) plus zero-count override, polite announcements, Escape/trigger/outside
dismissals, the lazy flow (open → callback → loading → items arrive), parent-close focus
restoration (focused item and focus-already-outside controls), and an omitted-props control
pinning current behavior. Fixture values (7 unread, 0–2 items) are inputs the component
cannot produce by accident.
The generated skill reference (
API.md) is updated by the rebase regeneration step: itgains only NotificationBell's new prop rows (
open,onOpenChange,count,loading,labels.loading), exactly what the land script's regeneration produces.Checklist
bun run validatepasses in full (the nine validate steps pass at this head; the run currently fails only on the newly added wall-time budget, red identically onmainitself)bun changeset) if the published package changessite/, AGENTS.md) if behavior or API changed, checked at desktop and phone width (n/a for visual width check: docs rendering is exercised by the site build and the land gate's changed-screenshot run)Footer
Generated by GPT-6.1 Sol (implementation, tests), GPT-6 Astra (review), GLM-5.3-Flash (orchestration)