Skip to content

Commit

Permalink
Consolidate valid tag regex -- this was inverted before for performan…
Browse files Browse the repository at this point in the history
…ce concerns but this is only used singularly and is not worth optimizing with modern javascript regex engines.
  • Loading branch information
dannon committed Nov 19, 2024
1 parent 6463f86 commit cbc49fe
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions client/src/components/TagsMultiselect/StatelessTags.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { useToast } from "@/composables/toast";
import { useUid } from "@/composables/utils/uid";
import { useUserTagsStore } from "@/stores/userTagsStore";
import { VALID_TAG_RE } from "../Tags/model";
import HeadlessMultiselect from "./HeadlessMultiselect.vue";
import Tag from "./Tag.vue";
Expand Down Expand Up @@ -84,10 +86,8 @@ const slicedTags = computed(() => {
}
});
const invalidTagRegex = /([.:\s][.:\s])|(^[.:])|([.:]$)|(^[\s]*$)/;
function isValid(tag: string) {
return !tag.match(invalidTagRegex);
return tag.match(VALID_TAG_RE);
}
function onTagClicked(tag: string) {
Expand Down

0 comments on commit cbc49fe

Please sign in to comment.