Skip to content

Commit 9b3c525

Browse files
committed
fix: Ensure WordList structure exists before adding items
When personalizing vocabularies with WordList items, the code was checking if originalGrid.Grid.WordList.Items existed before adding items. If the original page didn't have a WordList, items would not be added. This change ensures the WordList structure is created if it doesn't exist, allowing personalization items to be added to pages without existing WordLists.
1 parent ed935bb commit 9b3c525

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

src/processors/gridsetProcessor.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2768,7 +2768,18 @@ class GridsetProcessor extends BaseProcessor {
27682768
| Array<{ label: string; message: string }>
27692769
| undefined;
27702770

2771-
if (wordListItems && wordListItems.length > 0 && originalGrid.Grid?.WordList?.Items) {
2771+
if (wordListItems && wordListItems.length > 0) {
2772+
// Ensure WordList structure exists
2773+
if (!originalGrid.Grid) {
2774+
originalGrid.Grid = {};
2775+
}
2776+
if (!originalGrid.Grid.WordList) {
2777+
originalGrid.Grid.WordList = {};
2778+
}
2779+
if (!originalGrid.Grid.WordList.Items) {
2780+
originalGrid.Grid.WordList.Items = {};
2781+
}
2782+
27722783
const existingItems =
27732784
originalGrid.Grid.WordList.Items.WordListItem ||
27742785
originalGrid.Grid.WordList.Items.wordlistitem ||

0 commit comments

Comments
 (0)