8000 feat(signals): add Events plugin by markostanimirovic · Pull Request #4769 · ngrx/platform · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(signals): add Events plugin #4769

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

Merged
merged 6 commits into from
May 9, 2025
Merged

Conversation

markostanimirovic
Copy link
Member
@markostanimirovic markostanimirovic commented Apr 30, 2025

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Closes #4580

What is the new behavior?

Events plugin has been added to the @ngrx/signals package.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Copy link
netlify bot commented Apr 30, 2025

Deploy Preview for ngrx-site-v19 failed.

Name Link
🔨 Latest commit 01585bd
🔍 Latest deploy log https://app.netlify.com/sites/ngrx-site-v19/deploys/681e678fe2712b00083f420f

Copy link
netlify bot commented Apr 30, 2025

Deploy Preview for ngrx-io canceled.

Name Link
🔨 Latest commit 01585bd
🔍 Latest deploy log https://app.netlify.com/sites/ngrx-io/deploys/681e678f95ac50000832a1cd

Copy link
Member
@timdeschryver timdeschryver left a comment

Choose a reason for hiding this comment

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

This is looking good! 🤘
I left a couple of questions.

To include it to the docs you'll to also have to update the following files:

  • projects/ngrx.io/tools/transforms/authors-package/api-package.js
  • projects/ngrx.io/tools/transforms/angular-api-package/index.js

Copy link
Contributor
@rainerhahnekamp rainerhahnekamp left a comment

Choose a reason for hiding this comment

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

Super! I've left a few comments.

Some of them may have already been discussed during the RFC, but they only became apparent to me once I started using it.

@markostanimirovic
Copy link
Member Author

Changes from the last commit:

  • Added additional tests
  • eventCreator and eventCreatorGroup functions are renamed back to event and eventGroup for simplicity
  • Event type is renamed to EventInstance to avoid naming conflict with the global Event type
  • Explicit payload property is used for events. This change significantly simplified the implementation:
    • There are no multiple types for event/event creators with and without payload (Event/EventWithProps and EventCreator/EventCreatorWithProps). Instead, there are only two types: EventInstance and EventCreator.
    • props and emptyProps helpers are deleted. type from the core @ngrx/signals package can be used to define the payload type
    • Runtime checks of the payload type are removed because they're not needed anymore
    • Runtime check when the event creator is accidentally dispatched instead of the event is removed - compilation error will be thrown instead
  • The second argument (state) is removed from the case reducer callback because a partial state updater can be returned.

Copy link
Member
@timdeschryver timdeschryver left a comment

Choose a reason for hiding this comment

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

Nice work! 😎

Copy link
Contributor
@rainerhahnekamp rainerhahnekamp left a comment

Choose a reason for hiding this comment

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

Very good, just a minor issue with filenames and jsdoc for event(group) and the bigger one with including methods in withEffects

Copy link
Contributor
@rainerhahnekamp rainerhahnekamp left a comment

Choose a reason for hiding this comment

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

Wonderful. Good to go 🚀

@markostanimirovic markostanimirovic merged commit 980cf6f into main May 9, 2025
9 of 14 checks passed
@markostanimirovic markostanimirovic deleted the feat/signals/events branch May 9, 2025 20:57
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.

RFC: Add events plugin to @ngrx/signals
3 participants
0