mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
fix tag issue
This commit is contained in:
parent
a0dcf4f193
commit
994ea884a2
@ -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]);
|
||||
}
|
||||
});
|
||||
|
||||
@ -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<Tag>}) {
|
||||
const setTagData = useSetTagData();
|
||||
|
||||
@ -69,7 +69,7 @@ export class Geometry {
|
||||
|
||||
export interface Tag {
|
||||
color: string;
|
||||
id?: string;
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user