-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
fix: prevent unnecessary property updating in set_attributes
#6809
Conversation
fix: #6752 I think this issue is also much similar to #6751. But still, I don't get a comment from maintainer regarding this issue and PR. Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way we can test this?
@baseballyama is attempting to deploy a commit to the Svelte Team on Vercel. A member of the Team first needs to authorize it. |
I tried to add a test but I can not make focus on |
set_attributes
set_attributes
The Chrome date input issue is no longer reproducible, and this PR does not solve the bug with |
fix: #6751, #6752
This is an alternative way of #6758.
Original PR (#6758) uses
dependencies.size
before callget_dependencies()
.But in my understanding,
dependencies
have an attribute's dependencies.But
get_dependencies()
returns parent node's dependencies.So below logic looks a little bit weird to me.
(But honestly, I couldn't find any examples of anything being broken by this fix. So maybe this fix is okay...)
(If my understanding is wrong, please correct me.)
So I think the original code is okay regarding this part.
I think the root cause is different behavior between normal variables and spread syntax.
But I don't know how to fix it.
But I think, this behavior becomes an issue only during user input.
And I think in most cases, attributes are not changed during user input.
Therefore I thought 2 ways to fix this issue.
1. Stop calling unnecessary
set_attributes
.The runtime calls
set_attributes
even ifmin
is not changed but it's not necessary.So I thought if we can handle it at compile process, this is good.
But associative array (or JSON) can have nested objects.
Therefore compile process will be significantly complicated or impossible to handle.
And I think this is too much at least for this issue.
So I didn't choose this way.
2. Stop setting value if it's not changed (I choose this way in the PR)
This is a simple way.
Based on the assumption that the attributes will not change during user input,
set_attributes
will not apply new value if it's not changed.Actually already
attr
function did this way.So It'll just be the same process.
Before submitting the PR, please make sure you do the following
[feat]
,[fix]
,[chore]
, or[docs]
.Tests
npm test
and lint the project withnpm run lint
I'm so sorry If @Wojmis3 felt impolite,
And I apologize for the length of the text.
Thank you for reading!🎉