Skip to content

Notify client state subscribers on loading transitions#14

Merged
Junnyyy merged 1 commit into
mainfrom
notify-client-state-on-loading
Jun 19, 2026
Merged

Notify client state subscribers on loading transitions#14
Junnyyy merged 1 commit into
mainfrom
notify-client-state-on-loading

Conversation

@Junnyyy

@Junnyyy Junnyyy commented Jun 19, 2026

Copy link
Copy Markdown
Member

TL;DR

Notify subscribeToClientState() listeners when load() and reload() enter loading, while keeping flag-value subscriptions unchanged.

What changed?

  • Updated core client loading flow to emit client state changes when a fetch starts and when it settles
  • Preserved subscribe() and subscribeToFlag() behavior so they still only fire on effective flag value changes
  • Added a regression test covering the loading transition and subscriber separation
  • Updated the expected client-state notification count in the existing override flow test

How to test?

  • Run the core test suite and confirm the new loading-transition coverage passes
  • Verify the regression test asserts subscribeToClientState() sees loading before the fetch resolves
  • Confirm flag subscribers do not fire for loading-only transitions and still fire when values change

Why make this change?

  • Devtools and inspection surfaces need immediate loading/status updates without broadening normal flag subscriptions
  • This keeps client-state metadata responsive while preserving the existing semantics of value-based subscriptions

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.


Note

Low Risk
Narrow subscription-behavior change in core with tests; no auth or data-path changes, though devtools or inspection UIs may see extra client-state callbacks.

Overview
load() / reload() now emit subscribeToClientState() callbacks as soon as status becomes "loading", not only when the fetch finishes or errors. subscribe() and subscribeToFlag() are unchanged and still run only when effective flag values change.

AGENTS.md documents this split. Core tests add a regression case for the in-flight loading notification and update an existing client-state notification count.

Reviewed by Cursor Bugbot for commit 03575d0. Bugbot is set up for automated code reviews on this repo. Configure here.

@Junnyyy Junnyyy merged commit 53442d7 into main Jun 19, 2026
2 checks passed
@Junnyyy Junnyyy deleted the notify-client-state-on-loading branch June 19, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant