Skip to content
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

Fixed string conversion bug with global function #1711

Merged
merged 2 commits into from
Oct 22, 2023

Conversation

tomasherceg
Copy link
Member

If we call a global JS function from a binding and there is a viewmodel property with the same name, it takes precedence. In this case, we were converting bool to string by emitting String(value), but if there was a property called String in the viewmodel, it assigned the value in it.

This is a crazy bug, and this PR doesn't by far fix all cases - I am afraid it is almost impossible.

I fixed the String(...) and Number(...) cases but what if someone has a property called window in the viewmodel... ☠️
Luckily, most JS global functions start with a lowercase letter while viewmodel properties commonly start with an uppercase letter.

@tomasherceg tomasherceg merged commit 09d893c into main Oct 22, 2023
14 checks passed
@tomasherceg tomasherceg deleted the fix/tostring-global-function branch October 22, 2023 09:19
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