Comments (7)
This is indeed a bug. Take a look at #22. It's an update rather than create there, but it's the same issue.
from epf.
What do you guys think is the desired behavior here:
- Wait until the child session
flush()
is successful before updating the parent. - Optimistically update the parent when there is a
flush()
and rollback if it fails. - Keep the existing behavior and assume there is only isolation up until the first
flush()
call.
One of the main reasons for keeping things isolated is to support cancel
behavior. If a flush
is called it becomes clear the intent is not to cancel.
@jasonkriss thoughts?
from epf.
I think it should be either (1) or (2), and would prefer (1).
(3) is flawed because it allows errors from the child session to bleed into the main session which does not provide the level of encapsulation that you would expect from the child session
It should definitely be able to handle the conceptual case where a user tries to do something that saves to the server -> it then fails for whatever reason and gives the user feedback -> the user then decides to abandon the change.
I prefer (1) for the example case of a user updating their profile. Say they make some changes that are deemed to be invalid upon saving, the username is already taken for example, in this case you would not want the username attached to the main session to be updated to the new value.
Also by not updating the parent until the flush is successful it will mean that you can still cancel the change late in the day by simply walking away from the child session.
Thanks.
from epf.
I tend to agree with @ginty for the most part here. Although, I guess not familiar enough with the internals yet to understand if there would be any advantages to (3). The example of a user changing their username only to find out it is already taken, is definitely the kind of thing that happens quite a bit. In that case, it's crucial to get back the original value. It's obvious how this would work in (1) and (2), but how would it work in (3)?
@ghempton are you leaning towards a particular solution?
from epf.
I think I might ultimately support multiple isolation levels. I can see the argument for all 3 cases. The reason why #3 still appeals to me is that it allows for optimistically assuming the updates succeed (which I think is important). This also is related to @jasonkriss example in #51 when editing a profile inline.
from epf.
I would like to propose a variation on (1). Since there is not an actual transaction, on flush(), only those records that are successfully persisted are moved to the parent session. Any records that failed persisting remain in the child session to either be fixed and persisted, or abandoned.
At any rate, I like (3) the least as it pollutes the parent session whenever a flush() fails. (2) just seems like a more complicated variation of (1).
Just my two cents.
from epf.
This has since been cleared up. See #59
from epf.
Related Issues (20)
- Ep.IdSerializer can break with mongodb HOT 3
- typeKey seems incompatible with non-global Ember HOT 1
- Epf conflict with Ember.SimpleAuth HOT 6
- stricter jqXHR check
- Add `session.persist` HOT 1
- Testing EPF on ember-cli? HOT 6
- how to handle server error 500 on Model.find?
- Slow performance with 100 children HOT 5
- Using with ember-cli? HOT 6
- Still Alive? HOT 2
- Question: Embedded Documents HOT 24
- Embedded Update Error HOT 20
- Must be attached to a session. HOT 3
- Can't build distributable HOT 2
- Sideloading? HOT 6
- api documentation HOT 1
- Can't have belongsTo relation to work... HOT 2
- Delete parent model instance update children HOT 3
- Offline / network issues?
- Is the project dead? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from epf.