Skip to content
This repository

SC.Store#pushRetrieve should also accept records with status SC.Record.READY_NEW #876

Closed
mauritslamers opened this Issue · 1 comment

2 participants

Maurits Lamers Dave Porter
Maurits Lamers
Collaborator

I am currently developing an application in which I don't use the data sources to do the interaction with the server, but handle most of the stuff from the state chart. The app uses SC 1.4.5 (with some extras) but the code of the SC master branch is identical.

The flow is as follows: a new record is created in a nested store, the user edits, then saves.
The saving procedure then commits the nested store into the main store, then calles the core_app framework to actually save the records (keeping track of the records with changes using storeKeys).
The core_app framework retrieves the data hashes from the store, saves them at the back end, and then pushRetrieves the new record (including new id and revision) back into the store.

However, it turns out that this procedure requires me to hack the record status to READY_CLEAN before doing a pushRetrieve because it otherwise ignores the pushRetrieve. I don't want to change the status to any kind of BUSY state, because the app might get disconnected, or has long timeouts, and that would block the use of those new records.

Because pushRetrieve is also intended to be able to create records in the store that weren't there before (SC.Record.EMPTY), it is weird it cannot do READY_NEW.

The proposal therefore is to also allow records with READY_NEW to be pushRetrieved into the store.

I would love to hear your thoughts!

Dave Porter
Owner

The store assumes a straightforward state progression; new and dirty records must be busy before being saved. New records are more like dirty ones than empty ones, so that connection doesn't help here. Feel free to reopen the issue if you'd like to reopen discussion.

Dave Porter dcporter closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.