You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With NGXS v18, we have started to push towards better type safety for selectors.
The challenge is that we have users who use old mechanisms that are not type-safe and they would need guidance on converting their code to a more type-safe equivalent. Not only that, but there is an opportunity here to showcase all of the different helpers available.
We should definitely cover:
Use a StateToken instead of the State Class to select from a state
and the alternative of using createSelector with some type casting to wrap an existing State Class as a type-safe selector createSelector([MyState], s => s as MyStateModel)
Using createPropertySelectors to create smaller slices of your state
Using createPickSelector to optimise a selector that has fewer dependencies
Using createMappedSelector to combine selectors for view models, etc.
The text was updated successfully, but these errors were encountered:
If I have 20 different properties in my state, am I supposed to write 20 different selectors instead of just passing an inline function to the select statement? (more specifically regarding nested properties - I don't see that there are any shortcuts for creating those)
@dmrickey if you have the time, I would be interested to understand your use cases.
Reach out to me on the NGXS Discord or Slack and we can have a chat.
@markwhitfeld
The discord link doesn't appear to be a permanent link as it seems to be expired (or possibly just a bad link). I've joined the Slack, but the chances of me seeing a response there after today are minimal at best :/. My discord user name is claudekennilol. I'm available there practically 24/7.
I'd love to be able to join discord and ask questions that will be more visible than here on github issues.
Description
With NGXS v18, we have started to push towards better type safety for selectors.
The challenge is that we have users who use old mechanisms that are not type-safe and they would need guidance on converting their code to a more type-safe equivalent. Not only that, but there is an opportunity here to showcase all of the different helpers available.
We should definitely cover:
createSelector
with some type casting to wrap an existing State Class as a type-safe selectorcreateSelector([MyState], s => s as MyStateModel)
createPropertySelectors
to create smaller slices of your statecreatePickSelector
to optimise a selector that has fewer dependenciescreateMappedSelector
to combine selectors for view models, etc.The text was updated successfully, but these errors were encountered: