valaxy-theme-press 0.28.6 → 0.28.7

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.
@@ -2,7 +2,7 @@
2
2
  import type { AlgoliaSearchOptions } from '../types/algolia'
3
3
  import { onKeyStroke } from '@vueuse/core'
4
4
  import { useAddonConfig, useSiteConfig } from 'valaxy'
5
- import { computed, defineAsyncComponent, onMounted, ref } from 'vue'
5
+ import { computed, defineAsyncComponent, hydrateOnInteraction, onMounted, ref } from 'vue'
6
6
  import PressNavBarAskAiButton from './PressNavBarAskAiButton.vue'
7
7
  import PressNavBarSearchButton from './PressNavBarSearchButton.vue'
8
8
 
@@ -25,13 +25,25 @@ const PressAlgoliaSearch = isAlgolia.value
25
25
  ? defineAsyncComponent(() => import('./PressAlgoliaSearch.vue'))
26
26
  : () => null
27
27
 
28
- const PressFuseSearch = isFuse.value
29
- ? defineAsyncComponent(() => import('./PressFuseSearch.vue'))
30
- : () => null
28
+ /**
29
+ * Use lazy hydration (Vue 3.5+) to avoid hydration mismatch.
30
+ *
31
+ * `defineAsyncComponent` without a hydration strategy causes mismatch because
32
+ * the SSR bundle resolves async components synchronously (real DOM), while the
33
+ * client hasn't loaded the chunk yet during hydration (comment placeholder).
34
+ *
35
+ * `hydrateOnInteraction` keeps code-splitting benefits and defers hydration
36
+ * until the user actually interacts with the search button.
37
+ */
38
+ const PressFuseSearch = defineAsyncComponent({
39
+ loader: () => import('./PressFuseSearch.vue'),
40
+ hydrate: hydrateOnInteraction(['click', 'focusin']),
41
+ })
31
42
 
32
- const PressLocalSearch = isLocal.value
33
- ? defineAsyncComponent(() => import('./PressLocalSearch.vue'))
34
- : () => null
43
+ const PressLocalSearch = defineAsyncComponent({
44
+ loader: () => import('./PressLocalSearch.vue'),
45
+ hydrate: hydrateOnInteraction(['click', 'focusin']),
46
+ })
35
47
 
36
48
  // #region Algolia lazy loading
37
49
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valaxy-theme-press",
3
- "version": "0.28.6",
3
+ "version": "0.28.7",
4
4
  "description": "Docs Theme for Valaxy",
5
5
  "author": {
6
6
  "email": "me@yunyoujun.cn",
@@ -25,10 +25,10 @@
25
25
  "@docsearch/css": "^4.6.3",
26
26
  "@docsearch/js": "^4.6.3",
27
27
  "@docsearch/sidepanel-js": "^4.6.3",
28
- "reka-ui": "^2.9.6",
28
+ "reka-ui": "^2.9.7",
29
29
  "vitepress": "^2.0.0-alpha.17"
30
30
  },
31
31
  "devDependencies": {
32
- "valaxy": "0.28.6"
32
+ "valaxy": "0.28.7"
33
33
  }
34
34
  }