mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-02 10:15:11 +00:00
fix tags selection on channel edit page
This commit is contained in:
parent
59e8d693de
commit
aa69b227bd
1 changed files with 9 additions and 7 deletions
|
@ -181,13 +181,15 @@ function ChannelForm(props: Props) {
|
||||||
help={__('The better your tags are, the easier it will be for people to discover your channel.')}
|
help={__('The better your tags are, the easier it will be for people to discover your channel.')}
|
||||||
empty={__('No tags added')}
|
empty={__('No tags added')}
|
||||||
placeholder={__('Add a tag')}
|
placeholder={__('Add a tag')}
|
||||||
onSelect={newTag => {
|
onSelect={newTags => {
|
||||||
|
newTags.forEach(newTag => {
|
||||||
if (!params.tags.map(savedTag => savedTag.name).includes(newTag.name)) {
|
if (!params.tags.map(savedTag => savedTag.name).includes(newTag.name)) {
|
||||||
setParams({ ...params, tags: [...params.tags, newTag] });
|
setParams({ ...params, tags: [...params.tags, newTag] });
|
||||||
} else {
|
} else {
|
||||||
// If it already exists and the user types it in, remove it
|
// If it already exists and the user types it in, remove it
|
||||||
setParams({ ...params, tags: params.tags.filter(tag => tag.name !== newTag.name) });
|
setParams({ ...params, tags: params.tags.filter(tag => tag.name !== newTag.name) });
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
onRemove={clickedTag => {
|
onRemove={clickedTag => {
|
||||||
const newTags = params.tags.slice().filter(tag => tag.name !== clickedTag.name);
|
const newTags = params.tags.slice().filter(tag => tag.name !== clickedTag.name);
|
||||||
|
|
Loading…
Add table
Reference in a new issue