Skip to content

Commit

Permalink
Merge pull request #48 from hotosm/fix/6166-network-error-on-comment-tag
Browse files Browse the repository at this point in the history
fix/6166 network error on comment tag
  • Loading branch information
royallsilwallz authored Jan 25, 2024
2 parents cc3172b + 6e42c5c commit 9e82167
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions frontend/src/components/comments/commentInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ export const CommentInputField = ({
values: async (query, cb) => {
try {
if (!query) return cb(contributors.map((username) => ({ username })));

// do not fetch data if the value comes from suggestions popup click
const isValueFromSuggestion = /^\[.*?\]\s$/.test(query);
if (isValueFromSuggestion) return;

const res = await fetchLocalJSONAPI(`users/queries/filter/${query}/`, token);
cb(res.usernames.map((username) => ({ username })));
} catch (e) {
Expand Down

0 comments on commit 9e82167

Please sign in to comment.