Do you have example of using createAlgoliaClient to clear the cache?
See original GitHub issueI am trying to programmatically update the cache in my component.
Html
<button (click)="updateCache()">update<button>
<ng-ais-instantsearch [config]="algoliaEnv" >
<ng-ais-search-box></ng-ais-search-box>
<ng-ais-hits></ng-ais-hits>
Component
this.algoliaEnv = {
apiKey: <api-key>,
appId: <app-id>,
indexName: <index-name>,
createAlgoliaClient: this.testFunction,
};
testFunction(customClient: Function, appId: string, apiKey: string) {
// How do I use customClient here ?
const algoliaSearch: algoliasearch.AlgoliaClient = customClient(appId, apiKey);
return algoliaSearch;
}
updateCache(){
// What should I call here?
}
The above code does not throw any errors, but I am trying to figure out how to update the cache programmatically, for example inside the updateCache method. The documentation states: “We forward algoliasearch which is the original algoliasearch module imported inside angular-instantsearch.” - but how do I use this?
I really hope you can help me out here 😃
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Clear cache & cookies - Computer - Google Account Help
When you use a browser, like Chrome, it saves some information from websites in its cache and ... For example, you can delete...
Read more >How to Clear Cache on Android (And When You Should)
Choose the app whose cache you want to clear. To see which apps are taking the most space, tap the three-dot menu in...
Read more >How to Clear the Cache and Cookies in Your Web Browser
Keyboard Shortcut for Most Browsers. If you are using Internet Explorer, Edge, Google Chrome, or Mozilla Firefox you can quickly clear cache ......
Read more >What Is Cached Data and Should You Keep it or Clear it?
When this data is cached, we can reopen the app or revisit the page with confidence that it won't take anywhere near as...
Read more >What is a cache? And why does clearing it fix things?
It's timeless advice: if a website isn't loading properly, clear your browser's cache. We've all done it, noticed that things work again, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You were almost there, the function is called
refresh
and is on theinstantSearchInstance
, and you also need to implement the button in your app.I forked your sandbox: here is my version with the necessary changes.
Changes are:
app.component.html
: L83:<custom-widget></custom-widget>
custom-widget.ts
:custom-widget.component.html
:cc @compuIves, I also manage to get my browser crashing with the custom widget (but the code is correct)
I used code of your comment and now it’s working, thank you!