Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for abort controllers to event handlers #1151

Merged
merged 1 commit into from
Feb 26, 2025

Conversation

beeme1mr
Copy link
Member

This PR

  • adds an optional abort signal option to the addHandler API both globally and on the client.
  • updates the React useEffect hook to leverage the abort signal

Notes

This change was inspired by this blog. It allows us to use abort controllers to easily unregister event handlers. I've checked MDN to confirm that we shouldn't have any compatibility issues.

Follow-up Tasks

We'll need to bump the min peer dependency versions when releasing to avoid issues.

How to test

There should be pretty good test coverage of this. Please let me know if you spot any gaps.

@beeme1mr beeme1mr requested a review from a team as a code owner February 19, 2025 16:37
Copy link
Member

@lukas-reining lukas-reining left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice change!
I really like how this makes it unnecessary to keep a reference to the handler!
I think the react example speaks for itself.

@beeme1mr beeme1mr merged commit 6a22483 into main Feb 26, 2025
9 checks passed
@beeme1mr beeme1mr deleted the add-abort-signal-support branch February 26, 2025 21:17
github-merge-queue bot pushed a commit that referenced this pull request Apr 10, 2025
🤖 I have created a release *beep* *boop*
---


##
[1.8.0](core-v1.7.2...core-v1.8.0)
(2025-04-10)


### ✨ New Features

* add support for abort controllers to event handlers
([#1151](#1151))
([6a22483](6a22483))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Signed-off-by: OpenFeature Bot <[email protected]>
lukas-reining added a commit that referenced this pull request Apr 11, 2025
🤖 I have created a release *beep* *boop*
---


##
[1.18.0](server-sdk-v1.17.1...server-sdk-v1.18.0)
(2025-04-11)


### ✨ New Features

* add a top-level method for accessing providers
([#1152](#1152))
([ae8fce8](ae8fce8))
* add support for abort controllers to event handlers
([#1151](#1151))
([6a22483](6a22483))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Signed-off-by: OpenFeature Bot <[email protected]>
Co-authored-by: Lukas Reining <[email protected]>
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.

2 participants