-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
RFC(@ngrx/signals
): Add withProps
feature
#4504
Comments
Yes, that would be an addition, we definitely should have. Just two questions:
|
As suggested something like this last week on discord when talking with @rainerhahnekamp. It would be super useful to open many new capabilities and to avoid hacks with Are there any more details about limitations and where those props would be exposed? I'm hopping to have access to them in |
I updated the RFC description with more details:
|
This would be useful! Can props be private the same way state/computed/methods are? |
IMO it makes a lot of sense when integrating with libs/things from outside of angular ecosystem, which don't fit any of existing withState, withComputed etc. The only thing which bothers me is the name - |
@ducin thats why I also proposed alternative name Edited: Ahhh it was in other discussion |
Hi guys, Let's pretend I have one app state x (contained in a store, with its own computed and methods) However, if I load them, I need to take care of types and members being exposed upstream (app state). When I load the lazy feature n1, I'd like to have access to the same instance of the app state, react to changes in the state and "extend" with new computed and methods. I was exploring signalStoreFeature, but these are intended to extend instances of a store ahead of time. This issue looks interesting, and it might be the solution I'm looking for. Could you please confirm if this feature will satisfy the use case I mentioned? otherwise, I will need to look for alternatives. |
Which @ngrx/* package(s) are relevant/related to the feature request?
signals
Information
This feature request suggests adding another SignalStore base feature -
withProps
. It would allow static properties or observables to be defined as SignalStore members.It can also be used for defining all dependencies in a single place:
The
withProps
feature will be useful for library authors to reuse the same config across multiple features:In this example, both
withDevtools
andwithEvents
would use the source from thewithSource
feature.Signatures
The
withProps
feature would have 2 signatures:withProps({ foo: 'bar' })
withProps(() => ({ foo: 'bar' }))
withProps
factory function would accept previously defined state signals, computed signals, and properties.withComputed
,withMethods
, andwithHooks
would accept previously defined properties.I would be willing to submit a PR to fix this issue
The text was updated successfully, but these errors were encountered: