Skip to content

Commit

Permalink
check for class without potential modifier first
Browse files Browse the repository at this point in the history
Necessary becayse the isAny validator matches classes with validators too eagerly
  • Loading branch information
dcastil committed Apr 1, 2023
1 parent 573754b commit 9b35ce5
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/lib/merge-classlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@ export function mergeClassList(classList: string, configUtils: ConfigUtils) {
maybePostfixModifierPosition,
} = splitModifiers(originalClassName)

let classGroupId = getClassGroupId(baseClassName)
let hasPostfixModifier = false
let classGroupId = getClassGroupId(
maybePostfixModifierPosition
? baseClassName.substring(0, maybePostfixModifierPosition)
: baseClassName,
)

let hasPostfixModifier = Boolean(maybePostfixModifierPosition)

if (!classGroupId) {
if (!maybePostfixModifierPosition) {
Expand All @@ -38,9 +43,7 @@ export function mergeClassList(classList: string, configUtils: ConfigUtils) {
}
}

classGroupId = getClassGroupId(
baseClassName.substring(0, maybePostfixModifierPosition),
)
classGroupId = getClassGroupId(baseClassName)

if (!classGroupId) {
return {
Expand All @@ -49,7 +52,7 @@ export function mergeClassList(classList: string, configUtils: ConfigUtils) {
}
}

hasPostfixModifier = true
hasPostfixModifier = false
}

const variantModifier = sortModifiers(modifiers).join(':')
Expand Down

0 comments on commit 9b35ce5

Please sign in to comment.