Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
fix: duplicate tags issue using set constructor (#9820)
Browse files Browse the repository at this point in the history
changes made:
* replaced the standart array used for storing tags with a `Set` constructor.
* updated the documentation.
  • Loading branch information
badrivlog authored Nov 23, 2023
1 parent 42fb69f commit bde2fe9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pages/account/manage/event/[[...data]].js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export default function ManageEvent({ BASE_URL, event }) {
};

const handleTagAdd = (newTag) =>
setTags((prevState) => [...prevState, newTag]);
setTags((prevState) => [...new Set([...prevState, newTag])]);
const handleTagRemove = (tagToRemove) =>
setTags(tags.filter((tag) => tag !== tagToRemove));

Expand Down Expand Up @@ -343,7 +343,7 @@ export default function ManageEvent({ BASE_URL, event }) {
inputRef={tagInputRef}
/>
<p className="text-sm text-primary-medium-low dark:text-primary-low-high">
Separate tags with commas.
Separate tags with commas (tags cannot be duplicated).
</p>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions pages/account/manage/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default function Profile({ BASE_URL, profile, fileExists }) {
const { pronouns } = config;

const handleTagAdd = (newTag) => {
setTags((prevState) => [...prevState, newTag]);
setTags((prevState) => [...new Set([...prevState, newTag])]);
};

const handleTagRemove = (tagToRemove) => {
Expand Down Expand Up @@ -253,7 +253,7 @@ export default function Profile({ BASE_URL, profile, fileExists }) {
inputRef={tagInputRef}
/>
<p className="text-sm text-primary-medium-low dark:text-primary-low-high">
Separate tags with commas.
Separate tags with commas (tags cannot be duplicated).
</p>
</div>
</div>
Expand Down

0 comments on commit bde2fe9

Please sign in to comment.