-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Add clear and reset functionality to Bloodhound #703
Conversation
It would be nice for the reset method to accept new data as an optional argument. |
I think it would be great it if you could selectively choose specific prefetch data to reset. For if you're searching multiple large datasets you don't want to refetch all of 'em if just one has changed. Also something like clients.reset(true); clients.initialize(true); resets the modal but does not reset the local storage? |
FYI, merging this into our fork because we need a |
@mrtomtom can you clarify what you meant by this:
|
For the sake of posterity, this patch makes the following things possible: var engine = new Bloodhound({ /* ... */ });
// 1. clear suggestions loaded from local and prefetch
engine.clear();
// 2. clear prefetch data stored in local storage
engine.clearPrefrechCache();
// 3. clear cache of responses generated by remote requests
engine.clearRemoteCache();
// 4. reinitialize the suggestion engine i.e. load data
// from `local` and `prefetch`
engine.initialize(true); // have to pass true in order to reinitialize |
@jharding Sorry was away from keyboard. Just grabbed the latest version and using the code below it works perfectly. |
Just a simple remark regarding syntax : It's engine.clearPrefetchCache() and not engine.clearPrefrechCache() That's all 😄 thanks for this library ! |
See #694, #653, #223, and parts of #562.
Still need to add some test cases.