Closed byudaniel closed 9 years ago
As far as I know is this by design. Enable savequeing is a workaround or you can enable concurrentsaves (not recommended)
I have savequeuing enabled, which normally works for similar scenarios, but fails in this particular circumstance. Why is the save promise resolved before isBeingSaved is set to false? It makes the second saveChanges think the entity needs to be saved again when it has not changed.
I think you should share some code.
I need a repro. saveQueuing is supposed to prevent this kind of thing.
How I test it
I have a crude way of testing saveQueuing. Usually start with something like the Todo-Angular sample. I put a breakpoint on the Web API TodoController's SaveChanges
and run under debug. That breakpoint will simulate a long-running save.
Then in Chrome (or your browser) I set a breakpoint in breeze.saveQueuing.js around line 22 where it tests for if (saveQueuing.isSaving) ...
.
Then I cause a save (e.g., click a checkbox for a Todo). The first time it sails through (saveQueuing.isSaving
is false), the client makes the save call, and debugger breaks on the server in SaveChanges
. You trigger another save in the browser (e.g., click it again) and now saveQueuing should queue the save because the server hasn't replied (saveQueuing.isSaving
is true).
Let the server continue and all should be well.
What happens for you?
There are a great number of saveQueueing tests in DocCode ... and saveQueuing is now v.2.0.4. See this StackOverflow post. Would you please try again?
With the latest update I cannot duplicate the issue I was having. Thanks for the great update to saveQueuing!
If saveChanges is called very quickly with a complex data model it sometimes throws the error "Concurrent saves not allowed." An entity from the previous saveChanges call is included in the next call to saveChanges with an entityAspect of isBeingSaved = true. It appears that there is some kind of race condition where the previous save promise resolves before isBeingSaved is set to false.
(Using Breeze 1.5.0, Angular 1.0.8, breeze.savequeuing 0.9, breeze.angular 1.1)