You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all; you've guys really nailed it. Typeahead is simply awesomeness. Really good job!
I have a proposal, to change the way Bloodhound handles expired datasets / changed thumbprints using Prefetch. Currently, when it expires, the localstorage is cleared, and user has to wait until the new data has been fetched. This can, if the dataset expiry is set to a very low or even negative value (I need this, as my datasets change very often), be very annoying for the enduser, as there will often be a lot of wasted time for the user, waiting for the new dataset data to arrive.
When the dataset in localstorage is expired, I imagine it to work something like this:
User loads page. The expired localstorage will be used, until the request for new data has been completed.
Server loads the prefetch URL to fetch fresh data. When the data is received, it will overwrite the localstorage data.
Nice. Now the user still had instant suggestions (just from the expired dataset), while the new data was being loaded, and he did not even notice the dataset was refreshed!
EDIT:
I have created some code, which actually does what I want. Maybe the code will be better at explaining what I mean.
Bloodhound.prototype.refreshDataset = function() {
/**
* Keep self
*/
var BloodHound = this;
/**
* Run ajax
*/
$.ajax(BloodHound.prefetch.url, BloodHound.prefetch.ajax).done(function(resp) {
/**
* We have new data
*/
/**
* Clear existing content
*/
BloodHound.clear();
/**
* Add new content
*/
BloodHound.add(BloodHound.prefetch.filter ? BloodHound.prefetch.filter(resp) : resp);
/**
* Save new storage
*/
BloodHound._saveToStorage(BloodHound.index.serialize(), BloodHound.prefetch.thumbprint, self.prefetch.ttl);
});
}
The text was updated successfully, but these errors were encountered:
simplenotezy
changed the title
Proposal for "reloadPrefetch" setting
Proposal for silent refetch on expiry/thumbprint change using localstorage
Aug 10, 2014
Another issue mentions a similar idea, but I can't seem to find it right now. It's something I'd be open to adding. It's not a high priority for me, but I'd most likely accept a pull request.
First of all; you've guys really nailed it. Typeahead is simply awesomeness. Really good job!
I have a proposal, to change the way Bloodhound handles expired datasets / changed thumbprints using Prefetch. Currently, when it expires, the localstorage is cleared, and user has to wait until the new data has been fetched. This can, if the dataset expiry is set to a very low or even negative value (I need this, as my datasets change very often), be very annoying for the enduser, as there will often be a lot of wasted time for the user, waiting for the new dataset data to arrive.
When the dataset in localstorage is expired, I imagine it to work something like this:
EDIT:
I have created some code, which actually does what I want. Maybe the code will be better at explaining what I mean.
Can be used like this:
JSFIDDLE: http://jsfiddle.net/f5r371sL/1/ (no dataset)
The text was updated successfully, but these errors were encountered: