mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-16 23:55:20 +00:00
Clear query in url when search is cleared
This commit is contained in:
@@ -20,10 +20,12 @@ function query(q) {
|
||||
const searchState = getState().search;
|
||||
const currentQuery = searchState.query;
|
||||
|
||||
const queryString = q ? { q } : {};
|
||||
|
||||
if (currentQuery && q) {
|
||||
dispatch(Navigation.replace({ query: { q } }));
|
||||
dispatch(Navigation.replace({ query: queryString }));
|
||||
} else {
|
||||
dispatch(Navigation.push({ query: { q } }));
|
||||
dispatch(Navigation.push({ query: queryString }));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user