Replies: 1 comment
-
Hey! The Recent Searches plugins lets you save item from const recentSearchesPlugin = createLocalStorageRecentSearchesPlugin({ /* ... */ });
recentSearchesPlugin.data.addItem({
id: item.label,
label: item.label
}); You're right that we forgot to document it in the API ref. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi team,
Recently I use
createLocalStorageRecentSearchesPlugin
andcreateQuerySuggestionsPlugin
to build an autocomplete for search. In addition, I made a few customised plugins, mixed with the build-in plugins above.Everything works perfectly, but I found there is a limit when selecting items from the customised plugins, it will not be added to the local storage recent search.
I didn't find much from documents, so I took a further look into the code.
First thing first, there's a typo - should be
getDefaultSubscribe
.Then I found the issue is it only adds items from source id
querySuggestionsPlugin
to recent searches, so it doesn't work on my plugins with a different source id other thanquerySuggestionsPlugin
.I can overwrite the subscribe function, but the problem is there is no way to access its internal
store
to add an item unless I overwrite the entire storage object.My suggestion is to add another param to accept a list of source ids:
and checks whether the current source id is in the list:
Thanks,
Beta Was this translation helpful? Give feedback.
All reactions