@easyops-cn/docusaurus-search-local 0.48.2 → 0.48.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [0.48.3](https://github.com/easyops-cn/docusaurus-search-local/compare/v0.48.2...v0.48.3) (2025-01-16)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* sync ssr the input value and focus state for SSR ([be7c125](https://github.com/easyops-cn/docusaurus-search-local/commit/be7c125d72f7274eabc8d377809cddfd85fb1db1))
|
|
11
|
+
|
|
5
12
|
## [0.48.2](https://github.com/easyops-cn/docusaurus-search-local/compare/v0.48.1...v0.48.2) (2025-01-16)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -288,6 +288,23 @@ export default function SearchBar({ handleSearchBarToggle, }) {
|
|
|
288
288
|
const isMac = isBrowser
|
|
289
289
|
? /mac/i.test(navigator.userAgentData?.platform ?? navigator.platform)
|
|
290
290
|
: false;
|
|
291
|
+
// Sync the input value and focus state for SSR
|
|
292
|
+
useEffect(() => {
|
|
293
|
+
const searchBar = searchBarRef.current;
|
|
294
|
+
const domValue = searchBar?.value;
|
|
295
|
+
if (domValue) {
|
|
296
|
+
setInputValue(domValue);
|
|
297
|
+
}
|
|
298
|
+
if (searchBar && document.activeElement === searchBar) {
|
|
299
|
+
focusAfterIndexLoaded.current = true;
|
|
300
|
+
loadIndex();
|
|
301
|
+
setFocused(true);
|
|
302
|
+
handleSearchBarToggle?.(true);
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
// Only run this effect on mount
|
|
306
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
307
|
+
[]);
|
|
291
308
|
useEffect(() => {
|
|
292
309
|
if (!searchBarShortcut) {
|
|
293
310
|
return;
|