diff --git a/src/Components/Map/Layer.tsx b/src/Components/Map/Layer.tsx index cd6ed6b4..db3ca29d 100644 --- a/src/Components/Map/Layer.tsx +++ b/src/Components/Map/Layer.tsx @@ -159,7 +159,7 @@ export const Layer = ({ if (allTagsLoaded && allItemsLoaded) { item[itemTextField].toLocaleLowerCase().match(hashTagRegex)?.map(tag => { if ((!tags.find((t) => t.name.toLocaleLowerCase() === tag.slice(1).toLocaleLowerCase())) && !newTagsToAdd.find((t) => t.name.toLocaleLowerCase() === tag.slice(1).toLocaleLowerCase())) { - const newTag = { name: tag.slice(1).toLocaleLowerCase(), color: randomColor() }; + const newTag = { id: crypto.randomUUID(), name: tag.slice(1).toLocaleLowerCase(), color: randomColor() }; setNewTagsToAdd(current => [...current, newTag]); } }); diff --git a/src/Components/Map/Tags.tsx b/src/Components/Map/Tags.tsx index 3aadab5b..22c47c08 100644 --- a/src/Components/Map/Tags.tsx +++ b/src/Components/Map/Tags.tsx @@ -1,7 +1,7 @@ import * as React from 'react' import { useEffect } from 'react'; import { ItemsApi, Tag } from '../../types'; -import { useAddTag, useSetTagData, useSetTagApi } from './hooks/useTags' +import { useSetTagData, useSetTagApi } from './hooks/useTags' export function Tags({data, api} : {data?: Tag[], api?: ItemsApi}) { const setTagData = useSetTagData(); diff --git a/src/types.ts b/src/types.ts index 1dab967c..7447d1a3 100644 --- a/src/types.ts +++ b/src/types.ts @@ -69,7 +69,7 @@ export class Geometry { export interface Tag { color: string; - id?: string; + id: string; name: string; }