ahoym / redesert

Work in Progress - Opinionated HOFs for auto-generating REST API consuming redux logic
MIT License
3 stars 1 forks source link

Add existence check for entity to get<Entity>ErrorsById #25

Closed ahoym closed 6 years ago

ahoym commented 6 years ago

Is this a feature request or a bug report?

What is the current behavior?

Currently applications consuming redesert and using the get*ErrorsById selector will break if the entity that get*ErrorsById is trying to access doesn't exist. This is because it is trying to access a property of undefined or null.

Like in https://github.com/ahoym/redesert/pull/21, we should add an existence check to: https://github.com/ahoym/redesert/blob/1768160009ea6ea6a109c91ebf9cbcd507dcf59c/src/selector-factories/base-selectors.ts#L46

What is the expected behavior?

Using get*ErrorsById if the entity doesn't exist should return undefined or null depending on the user's designated default

ahoym commented 6 years ago

Resolved by: https://github.com/ahoym/redesert/pull/27, should be in v0.6.3