Versent / redux-crud

A set of standard actions and reducers for Redux CRUD Applications

Repository from Github https://github.comVersent/redux-crudRepository from Github https://github.comVersent/redux-crud

`createStart` does not mark record as "busy"

terinjokes opened this issue · comments

Is there a reason createStart does not mark records as "busy" like deleteStart and updateStart do? Right now I have nothing to match against if I want to show these pending records differently in the UI.

No good reason, it sounds like a sensible thing to do, will add it.

In my local fork I've chosen {pending: true, busy: true}, but obviously pretty easy to change if you think a better name works better.

I published v0.6.0. This adds unsaved and busy to the record on createStart. I went for unsaved because we are already using this keyword in updateStart.

The downside for using only unsaved is that now I can't distingish between "this record has no server component, so don't try to fetch subresources" and "this record exists on the server, perhaps with slightly different state" in my application or UI.

hi @terinjokes I don't quite follow, can you explain to me what is the difference between busy and pending to you? They seem like the same to me.

@sporto There's a difference.

I display a list of resources that link to another page. Under this list I allow you to add another, and I immediately put it in the list with a label "pending" and I don't allow you to click through to this resource, since that will trigger API calls for a resource that doesn't exist yet.

You can also edit information about the resources (mainly, just the resource name). Since "busy" is set, I can display some UI component that signifies this, but still allow the user to click through (since the API requests that triggers will still succeed).

If createStart overloads "busy" without adding something of it's own, I can't distinguish between these two scenarios. I either have to allow the user to click through (and have a broken app) or always prevent clicking through while a resource is "busy".

@terinjokes ok, I understand. So using unsaved on both create and update is not good enough. However pending doesn't have a good semantic distinction from busy. Maybe we can have something like pendingCreation and pendingUpdate.

@sporto I like that nomenclature.

Published 0.7.0, this adds pendingCreate and pendingUpdate

@terinjokes Do you think this will do?

Sorry, I thought I replied previously. This is great, the names describe
what's happening well. Thanks.

Terin Stock

On Mon, Oct 12, 2015 at 12:22 AM, Sebastian Porto notifications@github.com
wrote:

@terinjokes https://github.com/terinjokes Do you think this will do?


Reply to this email directly or view it on GitHub
#5 (comment).