Skip to content

Commit

Permalink
fix: prevent error in resolveVisualEditorData (#24)
Browse files Browse the repository at this point in the history
error was "siteLayoutConfigurations is not iterable"
  • Loading branch information
asanehisa authored Aug 22, 2024
1 parent 16a51ed commit d8b1528
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/utils/resolveVisualEditorData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,21 @@ export function resolveVisualEditorData(
};
}
}
// check layouts referenced by the site entity
for (const siteLayout of siteLayoutConfigurations) {
if (siteLayout.c_visualConfiguration?.template === templateName) {
const visualTemplate = JSON.parse(
validateOrDefault(siteLayout.c_visualConfiguration.data, templateName)
);
return {
...data,
document: {
...document,
visualTemplate,
},
};
if (siteLayoutConfigurations) {
// check layouts referenced by the site entity
for (const siteLayout of siteLayoutConfigurations) {
if (siteLayout.c_visualConfiguration?.template === templateName) {
const visualTemplate = JSON.parse(
validateOrDefault(siteLayout.c_visualConfiguration.data, templateName)
);
return {
...data,
document: {
...document,
visualTemplate,
},
};
}
}
}

Expand Down

0 comments on commit d8b1528

Please sign in to comment.