Fix: Clicking tags on share modal updates store immediately (#2720)

* Fix: Click tags on share modal share component to the store immediately

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: anovazzi1 <otavio2204@gmail.com>
This commit is contained in:
Igor Carvalho 2024-07-16 11:41:28 -03:00 • committed by GitHub
commit c4b86e9d63
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -26,35 +26,38 @@ export function TagsSelector({
return ( return (
<HorizontalScrollFadeComponent isFolder={false}> <HorizontalScrollFadeComponent isFolder={false}>
{!loadingTags && {!loadingTags
tags.map((tag, idx) => ( ? tags.map((tag, idx) => (
<button <button
disabled={disabled} disabled={disabled}
className={ className={
disabled disabled
? "cursor-not-allowed" ? "cursor-not-allowed"
: "overflow-hidden whitespace-nowrap" : "overflow-hidden whitespace-nowrap"
} }
onClick={() => { onClick={(e) => {
updateTags(tag.name); e.preventDefault();
}} e.stopPropagation();
key={idx} updateTags(tag.name);
data-testid={`tag-selector-${tag.name}`} }}
>
<Badge
key={idx} key={idx}
variant="outline" data-testid={`tag-selector-${tag.name}`}
size="sq"
className={cn(
selectedTags.some((category) => category === tag.name)
? "min-w-min bg-beta-foreground text-background hover:bg-beta-foreground"
: "",
)}
> >
{tag.name} <Badge
</Badge> key={idx}
</button> variant="outline"
))} size="sq"
className={cn(
selectedTags.some((category) => category === tag.name)
? "min-w-min bg-beta-foreground text-background hover:bg-beta-foreground"
: "",
)}
>
{tag.name}
</Badge>
</button>
))
: []}
</HorizontalScrollFadeComponent> </HorizontalScrollFadeComponent>
); );
} }