-
Notifications
You must be signed in to change notification settings - Fork 77
Eject before HTTP destroy #169
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
Comments
I could work something out for |
In many cases the UI doesn't need to wait until the HTTP is done. Cases like My suggestion is to manage a list of pending items: Before create, mark the item as It brings more ideas that would help offline data, request queues and retries, but that's another subject. |
Have your tried either of these? // inject and eject emit events on $rootScope, can be configured to $emit, $broadcast, or none
$rootScope.$on('DS.eject', function ($event, resourceName, ejectedItem) {
// ...
}); Or // Emit events yourself
DS.defineResource({
name: 'category',
afterDestroy: function (resourceName, attrs, cb) {
$rootScope.$broadcast('destroy', resourceName, attrs);
cb(null, attrs);
}
}); Edit: I meant to post this on #170 |
Here's a POC for inject before create and eject before destroy: elado@a84c5c3 Tests are broken but this is just a start. Tested on my UI and it's way more responsive. It doesn't wait for the endpoint to response, so "type, enter, type, enter, type, enter" just works without delays. Thoughs? |
Awesome!!! Thanks. |
Right now, when destroying an item,
eject
is called only after the HTTP is resolved.In the UI, it'll update the list only after it was ejected. For a more responsive UI,
eject
can (optionally?) happen before destroy, same forcreate
+inject
.The text was updated successfully, but these errors were encountered: