Skip to content

@ngrx/signals: Allow returning an array of observables from withEventHandlers #5000

@markostanimirovic

Description

@markostanimirovic

Which @ngrx/* package(s) are relevant/related to the feature request?

signals

Information

The withEventHandlers factory (renamed from withEffects in v21) expects a dictionary of observables:

withEventHandlers((store, events = inject(Events)) => ({
  logType$: events.on(increment).pipe(
    tap(console.log)
  ),
})),

While this should still be the preferred way for user-defined handlers for better readability, the ability to return an array of observables will provide additional flexibility and reduce overhead in some cases:

withEventHandlers((store, events = inject(Events)) => [
  events.on(increment).pipe(tap(console.log)),
]),

Describe any alternatives/workarounds you're currently using

No response

I would be willing to submit a PR to fix this issue

  • Yes
  • No

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions