Versent / redux-crud

A set of standard actions and reducers for Redux CRUD Applications
MIT License
624 stars 54 forks source link

Allow passing an array to createSuccess and updateSuccess #57

Open GuillaumeJasmin opened 7 years ago

GuillaumeJasmin commented 7 years ago

Hi,

It's currently impossible to use an array of data with createSuccess() or updateSuccess(). I would like to do this: createSuccess(data) with data as an array. Same for updateSuccess(). I get an error when I try to insert an array instead of an object, it works only for fetchSuccess().

I work with batch update on my server, and I need to insert the results list without use updateSuccess() many times, because if I have 20 rows, I have to do 20 dispatch(), so 20 UI updates. Very bad for performances.

Is there going to be a future update for this ?

Thanks :)

jsherbert commented 7 years ago

+1, but in lieu of a PR, if you're struggling for performance there are packages that allow you to combine actions to avoid UI updates, e.g. redux-batched-actions.

GuillaumeJasmin commented 7 years ago

Oh thanks ! Yes it's a good alternative, I will use that.

However it would be very nice to have a future enhancement for batch update feature, even if it's not high priority because there is an alternative as you specified.

Thanks ! :)

sporto commented 7 years ago

This sounds like a useful feature. Hopefully someone would like to make a PR.