Skip to content

Commit 1798e64

Browse files
committed
fix(search content): Remove delete page types and collection keys from selected scope automatically so they're not included in results
1 parent 609b9c6 commit 1798e64

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

src/components/WhatsNew.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ interface Feature {
4040
const showModal = ref<boolean>(false)
4141
4242
const features: Feature[] = [
43+
{
44+
id: 'api-config-delete-keys',
45+
type: 'bugfix',
46+
title: 'Deleting page types or collection keys may have caused errors when searching content',
47+
description:
48+
'If you deleted a page type or a collection key from the API Configuration section, you may have encountered errors when searching content that belonged to those page types or collection keys because they were still included in the search scope if you had them selected when you deleted them. This has now been fixed so that deleting page types or collection keys will no longer cause errors in the Search Content utility.',
49+
utcDatetimeAdded: new Date('2026-02-10T20:45:00Z'),
50+
},
4351
{
4452
id: 'search-content-negate',
4553
type: 'improvement',

src/stores/index.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,29 @@ export const useStore = defineStore('store', () => {
9191
{ deep: true },
9292
)
9393

94+
// Watch for changes in pageTypes and collectionKeys to clean up selectedScopes
95+
watch(
96+
() => ({ pageTypes: config.value.pageTypes, collectionKeys: config.value.collectionKeys }),
97+
(newValues) => {
98+
const cleanedPageTypes = config.value.selectedScopes.pageTypes.filter((pt) =>
99+
newValues.pageTypes.includes(pt),
100+
)
101+
const cleanedCollectionKeys = config.value.selectedScopes.collectionKeys.filter((ck) =>
102+
newValues.collectionKeys.includes(ck),
103+
)
104+
105+
if (
106+
cleanedPageTypes.length !== config.value.selectedScopes.pageTypes.length ||
107+
cleanedCollectionKeys.length !== config.value.selectedScopes.collectionKeys.length
108+
) {
109+
config.value.selectedScopes = {
110+
...config.value.selectedScopes,
111+
pageTypes: cleanedPageTypes,
112+
collectionKeys: cleanedCollectionKeys,
113+
}
114+
}
115+
},
116+
)
117+
94118
return { token, lockToken, includePreview, pageTypes, collectionKeys, selectedScopes }
95119
})

0 commit comments

Comments
 (0)