Skip to content

Commit

Permalink
Fix export error when custom collections undefined
Browse files Browse the repository at this point in the history
Signed-off-by: Zvonimir Fras <[email protected]>
  • Loading branch information
zvonimirfras committed Dec 4, 2023
1 parent 9b68e09 commit 8ba24eb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const jsonToTemplate = (json: any, fragments: any[], customComponentsColl
itemsTemplate = json.items.map((item: any) => jsonToTemplate(item, fragments, customComponentsCollections)).join('\n');
}

const activeCollection = customComponentsCollections?.find((collection) => collection.name === json.componentsCollection);
const activeCollection = customComponentsCollections.find((collection) => collection.name === json.componentsCollection);
if (!activeCollection) {
return itemsTemplate;
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/utils/fragment-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const getFragmentsFromLocalStorage = () => {

export const getCustomComponentsCollectionsFromLocalStorage = () => {
try {
return JSON.parse(localStorage.getItem('customComponentsCollections') as string);
return JSON.parse(localStorage.getItem('customComponentsCollections') as string) || [];
} catch (error) {
console.warn('Error loading custom components collections:', error);
return [];
Expand Down

0 comments on commit 8ba24eb

Please sign in to comment.