Skip to content

feat: add createExternalStore utility and ClockProvider (v4 backport)#247

Open
gcutrini wants to merge 1 commit into
v4.xfrom
feature/external-store-clock-context-v4
Open

feat: add createExternalStore utility and ClockProvider (v4 backport)#247
gcutrini wants to merge 1 commit into
v4.xfrom
feature/external-store-clock-context-v4

Conversation

@gcutrini
Copy link
Copy Markdown
Contributor

ref: https://app.clickup.com/t/86b8e70g2

Backport of #195 to the v4.x maintenance branch so event-site (currently on uicore 4.2.29) can adopt ClockProvider without committing to a full MUI v5 -> v6 migration up-front.

What's included

  • src/utils/external-store.js — generic createExternalStore factory built on useSyncExternalStore
  • src/components/clock-context.jsClockProvider, useClock, useClockSelector (wraps the existing Clock)
  • New webpack entries: components/clock-context, utils/external-store
  • New exports from src/components/index.js
  • New dep: use-sync-external-store@^1.6.0

Tests

24 new tests (12 for the store factory, 8 for the clock context, 4 misc). Pinned @testing-library/react@^11 for React 16 compatibility (the v5 PR uses v12+). Full suite: 123/123 pass.

Notes

  • React 16 currently; per the readme note, the shim import can be replaced with the native react one when the v5 line moves to React 18.
  • Functionally identical to feat: add createExternalStore utility and ClockProvider #195. The only deltas are the testing-library version pin and the package.json/yarn.lock layout matching v4.

Backport of #195 to v4.x. Adds a generic external store factory
(createExternalStore) using useSyncExternalStore that lets components
subscribe to frequently-updating data sources without unnecessary
re-renders, plus a pre-built clock store (ClockProvider, useClock,
useClockSelector) wrapping the existing Clock component.

Tests use @testing-library/react@11 for React 16 compatibility.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 21, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 337e3d12-a6f1-4f99-9f42-8fbbc95c08f0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/external-store-clock-context-v4

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gcutrini gcutrini requested a review from smarcet May 21, 2026 12:35
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