@glossarist/concept-browser 0.7.41 → 0.7.42

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glossarist/concept-browser",
3
- "version": "0.7.41",
3
+ "version": "0.7.42",
4
4
  "description": "Vue SPA for browsing Glossarist terminology datasets with cross-reference resolution, graph visualization, and multi-language support",
5
5
  "type": "module",
6
6
  "bin": {
@@ -30,10 +30,17 @@ const chunkLoading = ref(false);
30
30
  // Background chunk preloading via requestIdleCallback
31
31
  let idlePreloadHandle: ReturnType<typeof requestIdleCallback> | ReturnType<typeof setTimeout> | null = null;
32
32
 
33
- watch(adapter, (a) => {
34
- if (idlePreloadHandle !== null) return;
33
+ watch(adapter, async (a) => {
35
34
  if (!a || !a.index) return;
36
35
 
36
+ // If a section filter is active, load all chunks immediately (not idle)
37
+ if (sectionQuery.value && !allChunksLoaded.value) {
38
+ await ensureAllChunksForFilter(true);
39
+ return;
40
+ }
41
+
42
+ if (idlePreloadHandle !== null) return;
43
+
37
44
  const schedule: (cb: () => void) => number = typeof requestIdleCallback !== 'undefined'
38
45
  ? (cb) => requestIdleCallback(cb, { timeout: 2000 })
39
46
  : (cb) => window.setTimeout(cb, 0);
@@ -87,6 +94,7 @@ const allChunksLoaded = ref(false);
87
94
  const selectedLang = ref<string | null>(null);
88
95
  const viewMode = ref<'systematic' | 'alphabetical'>('systematic');
89
96
  const sectionQuery = computed(() => (route.query.section as string) || null);
97
+ const page = ref(1);
90
98
 
91
99
  interface LangOption {
92
100
  code: string;
@@ -124,10 +132,14 @@ onUnmounted(() => window.removeEventListener('keydown', onGlobalKeydown));
124
132
 
125
133
  async function ensureAllChunksForFilter(needsLoad: boolean) {
126
134
  page.value = 1;
127
- if (needsLoad && !allChunksLoaded.value && adapter.value) {
128
- chunkLoading.value = true;
129
- await adapter.value.ensureAllChunksLoaded();
135
+ if (!needsLoad || allChunksLoaded.value) return;
136
+ const a = adapter.value;
137
+ if (!a?.index) return;
138
+ chunkLoading.value = true;
139
+ try {
140
+ await a.ensureAllChunksLoaded();
130
141
  allChunksLoaded.value = true;
142
+ } finally {
131
143
  chunkLoading.value = false;
132
144
  }
133
145
  }
@@ -138,7 +150,7 @@ watch(filter, async (q) => {
138
150
 
139
151
  watch(sectionQuery, async () => {
140
152
  await ensureAllChunksForFilter(!!sectionQuery.value);
141
- });
153
+ }, { immediate: true });
142
154
 
143
155
  watch(selectedLang, async (lang) => {
144
156
  await ensureAllChunksForFilter(!!lang);
@@ -202,7 +214,6 @@ const alphabetGroups = computed(() => {
202
214
  return [...groups.entries()].sort((a, b) => a[0].localeCompare(b[0]));
203
215
  });
204
216
 
205
- const page = ref(1);
206
217
  const perPage = 50;
207
218
 
208
219
  // Check if the current page range is loaded in the index