Repository navigation
Conversation
🦋 Changeset detectedLatest commit: e7b3ff6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
c052312 to
01ac8b5
Compare
01ac8b5 to
cbed3f8
Compare
cbed3f8 to
6325dfb
Compare
6325dfb to
cd43ddd
Compare
There was a problem hiding this comment.
🟢 Approval recommended
Static review found no blocking issues, and regression coverage addresses the preserved contracts; tests were not executed.
No open issues 🎉
What changed in this PR
Stabilizes Escape and outside-click subscriptions in Primer React, preparing for further compiler migration without changing public APIs.
Changes:
- Reuses effect-synchronized callbacks to avoid listener churn.
- Lazily initializes Escape handler IDs.
- Adds regression coverage and a patch changeset.
| File | Description |
|---|---|
| packages/react/src/hooks/useOnOutsideClick.tsx | Stabilizes outside-click callbacks. |
| packages/react/src/hooks/useOnEscapePress.ts | Stabilizes callbacks and lazily initializes IDs. |
| packages/react/src/hooks/__tests__/useOnOutsideClick.test.tsx | Tests callback updates, listener stability, and cleanup. |
| packages/react/src/hooks/__tests__/useOnEscapePress.test.tsx | Tests listener stability, dependencies, cleanup, and nested priority. |
| .changeset/stable-event-hook-callbacks.md | Records the patch performance improvement. |
Review effort: Balanced
Removed both I added the broad cleanup as a test-isolation precaution for those spies, not because a skill or instruction required it. I found no supporting guidance to cite; the suite-wide cleanup was unnecessary. All 11 affected tests and the full repository checks passed (2,901 tests, build, type checking, lint, and formatting). |
There wasn't a source for the
Switched both hook test files to restore spies in |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e632d4e3-54d2-4423-9888-8e37b00494a3
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
318b64f to
e7b3ff6
Compare
|
Integration test results from github/github-ui PR: |
Follow up to #8558.
This PR updates
useOnEscapePressanduseOnOutsideClickto use our existing effect-synchronized callback helper. Callback changes no longer re-register their event handlers or reattach the document listener.The public APIs stay the same, including explicit callback dependencies passed to
useOnEscapePress. This is preparation for its compiler migration;useOnEscapePressremains excluded while we preserve that dependency-array contract.Changelog
New
Changed
Removed
Rollout strategy
This is a patch performance improvement with no public API changes.