Closed erkkaha closed 6 years ago
I will look into this when I return from vacation next Wednesday.
@erkkaha, Good catch. I didn't have this issue because services.find() (which replaces the queryResult from null to proper structure) was executed before the ON_CREATED. I think structuring the queryResult initial state would be a better approach rather than checking if queryResult is null within the reducer switch case statement.
Have the same result. Can it be fixed in next few days?
Reportedly fixed in https://github.com/feathers-plus/feathers-redux/pull/43
Published as 2.1.0
https://github.com/feathers-plus/feathers-redux/blob/cf5b00b8634b34e151ca4473938c5882655de9c1/src/index.js#L244
There is an issue with ON_CREATED and other event reducers if query result is null, since there is no null check an error will be thrown if actions are dispatched before anything has been queried. I can make a PR to fix this, but I was wondering is what is the reason why initial state has queryResult: null? As this could be fixed by either checking if queryResult exists or adding initial state with empty data and total:0.