diff --git a/src/Components/Map/Layer.tsx b/src/Components/Map/Layer.tsx index 0cd56aad..014fb828 100644 --- a/src/Components/Map/Layer.tsx +++ b/src/Components/Map/Layer.tsx @@ -172,7 +172,7 @@ export const Layer = ({ if (item.tags) { item.text += '\n\n' item.tags.map((tag) => { - if (!item.text.includes(`#${encodeTag(tag)}`)) { + if (!item.text?.includes(`#${encodeTag(tag)}`)) { item.text += `#${encodeTag(tag)}` } return item.text @@ -180,7 +180,7 @@ export const Layer = ({ } if (allTagsLoaded && allItemsLoaded) { - item.text.match(hashTagRegex)?.map((tag) => { + item.text?.match(hashTagRegex)?.map((tag) => { if ( !tags.find( (t) => t.name.toLocaleLowerCase() === tag.slice(1).toLocaleLowerCase(), diff --git a/src/Components/Map/Subcomponents/ItemFormPopup.tsx b/src/Components/Map/Subcomponents/ItemFormPopup.tsx index ed35d861..48f9e0ff 100644 --- a/src/Components/Map/Subcomponents/ItemFormPopup.tsx +++ b/src/Components/Map/Subcomponents/ItemFormPopup.tsx @@ -189,7 +189,7 @@ export function ItemFormPopup(props: ItemFormPopupProps) { key={props.position.toString()} placeholder='Text' dataField='text' - defaultValue={props.item ? props.item.text : ''} + defaultValue={props.item?.text ?? ''} inputStyle='tw-h-40 tw-mt-5' /> diff --git a/src/types/Item.d.ts b/src/types/Item.d.ts index 36765a33..8723732c 100644 --- a/src/types/Item.d.ts +++ b/src/types/Item.d.ts @@ -18,7 +18,7 @@ interface GalleryItem { export interface Item { id: string name: string - text: string + text?: string data?: string position?: Point | null date_created?: string