RecentQueriesList (Commerce Engine)
RecentQueriesList (Commerce Engine)
|
|
Note
This component was introduced in version |
The RecentQueriesList controller manages the user’s recent queries.
Methods
clear
Clears the recent queries list.
executeRecentQuery
Executes the given recent query.
Parameters
-
index:
numberThe index of the recent query to execute.
subscribe
Adds a callback that’s invoked on state change.
Parameters
-
listener:
() => voidA callback that’s invoked on state change.
Returns Unsubscribe: A function to remove the listener.
Attributes
state
The state of the RecentQueriesList controller.
Properties
-
analyticsEnabled:
booleanWhether analytics and tracking are enabled. In the case where it is disabled, it is recommended not to save recent queries.
-
maxLength:
numberThe maximum number of queries to retain in the list.
-
queries:
string[]The list of recent queries.
Initialize
buildRecentQueriesList
Creates a RecentQueriesList controller instance.
Parameters
-
engine:
CommerceEngineThe headless engine.
-
props:
RecentQueriesListPropsThe configuration
RecentQueriesListproperties.
Returns RecentQueriesList
RecentQueriesListProps
The configuration RecentQueriesList properties.
Properties
-
initialState?:
RecentQueriesListInitialStateThe initial state that should be applied to the
RecentQueriesListcontroller. -
options?:
RecentQueriesListOptionsThe configuration options that should be applied to the
RecentQueriesListcontroller.
RecentQueriesListInitialState
The initial state that should be applied to the RecentQueriesList controller.
Properties
-
queries:
string[]The list of recent queries.
Default:
[]
RecentQueriesListOptions
The configuration options that should be applied to the RecentQueriesList controller.
Properties
-
maxLength:
numberThe maximum number of queries to retain in the list.
Default:
10 -
clearFilters?:
booleanWhether to clear all active query filters when the end user submits a new query from the recent queries list. Setting this option to "false" is not recommended and can lead to an increasing number of queries returning no results.
Related types
Unsubscribe
Call signatures
-
(): void;