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

avoid updating text node if value is the same after converting to a string #325

Merged
merged 1 commit into from
Jun 25, 2024

Conversation

titoBouzout
Copy link
Contributor

On this example, the node flashes on the dev tools because its failing the equality check, as whats on the dom is a string and the new value is a number https://playground.solidjs.com/anonymous/abf375c1-7f30-4d09-bf19-e543a5681e70

quoting from a discord message

That's happening because it's failing this triple equality check https://github.com/ryansolid/dom-expressions/blob/main/packages/dom-expressions/src/client.js#L409 , as what's rendered is the 0 string and the new data is 0 the number. It's then converted to a string https://github.com/ryansolid/dom-expressions/blob/main/packages/dom-expressions/src/client.js#L416
but then it's not compared when updating on this case https://github.com/ryansolid/dom-expressions/blob/main/packages/dom-expressions/src/client.js#L425C26-L425C41
If you convert it to a string on the neutralizeCount call it stops flashing on the dev tools https://playground.solidjs.com/anonymous/cadbf84e-aef3-4a19-9b99-f0b6434e2725

@ryansolid ryansolid merged commit 29e88cb into ryansolid:main Jun 25, 2024
1 check failed
@ryansolid
Copy link
Owner

Thanks

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.

None yet

2 participants