-
Notifications
You must be signed in to change notification settings - Fork 138
Support for temporary items #284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Behaviour of inject, filter and isNew implemented as proposed in ticket
I'm not sure I like the performance implications of storing an array of temporary IDs, and having to search the array on every iteration of the filter callback. What about actually attaching a property to a temporary item itself that marks it as temporary? Or instead of an array of IDs, keep an index of IDs for O(1) lookup times? |
Yes that make sense. I was thinking about a property for each instance but I did not want to mix data properties and internal properties of an instance. Maybe I missed something - is there a way of hiding an internal property? |
@jmdobry I am thinking about what would be the best way of replacing the artifical ID with the one returned by the server. Foreign keys of other items referencing the temporary item have to be updated as well. |
I hadn't considered that, I think I'm losing enthusiasm for this feature. |
Mh too bad - I think this feature could be really helpful. I thought about if it would be possible keeping the original ID (=guid) internally, while exposing the updated Id to the user. Or do you prefer to abandon the feature completely? |
I'm working on this in v3, I'll see if I can find a nice way to back port it. |
@jmdobry Am i right in thinking that this only handles temporary ids for a specific resource and DOES NOT update relations when the new id is returned from the server? |
Right On Mon, Feb 29, 2016, 5:05 PM Jesse Houchins [email protected]
|
Is there any documentation for this feature? Throughout my code when creating new resources I've had to do things like:
But maybe I should have been doing:
I don't see the word "temporary" anywhere when searching the documentation. |
Seems like that won't work because resolveId doesn't know about the temporary option and many of promises check for the id being a string or number and reject immediately if not. So I guess this doesn't really help. I'm not finding the documentation I need to understand the whole process of how to create new resources in the real world. |
In V3 records have an |
Behaviour of inject, filter and isNew implemented as proposed in ticket #197
There are still some open points such as
DSSave
andDSCreate
. @jmdobry maybe you can make some comments if I am on the right track.