Skip to content

docs: useSyncExternalStore pattern undocumented for consumers #255

@panz3r

Description

@panz3r

Context

Discovered during development of the showcase example (PR #252).

Problem

EnhancedAuthClient exposes subscribe and getSnapshot methods (compatible with React's useSyncExternalStore), but no existing example or README mentions this pattern. Without it, components only re-render via useAsyncCallback loading-state changes, which is fragile for multi-component layouts — auth state changes may not propagate correctly.

Impact

Consumers are unaware of the recommended pattern for subscribing to auth state in multi-component layouts, which can lead to subtle UI bugs where components don't re-render on auth state changes.

Proposed Action

  • Add a usage example of useSyncExternalStore with EnhancedAuthClient to the core library README.md.
  • Consider adding a dedicated section in the docs covering reactive auth state consumption patterns.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions