diff --git a/.gitignore b/.gitignore
index 5ede36d32..6a1335a70 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,3 +32,4 @@ dist
.rpt2_cache
.cache
.docz
+.idea
diff --git a/packages/docz-theme-default/src/components/shared/Sidebar/index.tsx b/packages/docz-theme-default/src/components/shared/Sidebar/index.tsx
index 890be225e..ab0f0ff55 100644
--- a/packages/docz-theme-default/src/components/shared/Sidebar/index.tsx
+++ b/packages/docz-theme-default/src/components/shared/Sidebar/index.tsx
@@ -139,6 +139,7 @@ interface State {
state: {
docs?: Entry[] | null
searching?: boolean
+ lastVal: string
}
}
@@ -161,7 +162,7 @@ const mapper = {
config: ,
docs: ,
media: ,
- state: ,
+ state: ,
toggle: ,
}
@@ -195,7 +196,14 @@ export const Sidebar = () => (
const docsWithoutMenu = docs.filter((doc: Entry) => !doc.menu)
const fromMenu = (menu: string) => docs.filter(doc => doc.menu === menu)
- const search = (val: string) => match(docs, val, { keys: ['name'] })
+ const search = (val: string) => {
+ const change = !val.startsWith(state.lastVal)
+ setState({
+ lastVal: val,
+ })
+ if (change) return match(initialDocs, val, { keys: ['name'] })
+ return match(docs, val, { keys: ['name'] })
+ }
const handleSearchDocs = (val: string) => {
const isEmpty = val.length === 0