8000 fix: reset postfix modifier position if invalid by grievouz · Pull Request #14 · Oudwins/tailwind-merge-go · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: reset postfix modifier position if invalid #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 16, 2025

Conversation

grievouz
Copy link
Contributor
@grievouz grievouz commented Jan 15, 2025

Reset postfix modifier position if invalid

Description

This PR adds a missing else clause that ensures the postfix modifier position is properly reset when invalid, bringing the behavior in line with the original repository's implementation. The change fixes an issue where invalid positions weren't being reset to -1, which could lead to index out of bounds errors in certain cases, as demonstrated by the newly added test cases.

https://github.com/dcastil/tailwind-merge/blob/a8b2a84568a50aa01e97d2602f6ed9d9c14fe634/src/lib/parse-class-name.ts#L54C1-L57C28

@Oudwins
Copy link
Owner
Oudwins commented Jan 15, 2025

Thank you for this. I'll have a look at it tonight! You rock. Good to know I missed an if statement 😅

@Oudwins Oudwins merged commit 6db9533 into Oudwins:master Jan 16, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0