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

Performance improvement for AttributeValueHolder delegate #345

Merged

Conversation

Dreamescaper
Copy link
Contributor

@Dreamescaper Dreamescaper commented Mar 11, 2021

While working on CollectionView I realized, that our approach with AttributeValueHolder approach has an issue - created delegates are not considered equal for same value, therefore Blazor considers those attribute values as changed on each component update.
I've created an extension method This, which simply returns 'this' parameter, and create a delegate from method parameter. Delegates created in such way are considered equal for same objects, and Blazor does not re-render same attributes over and over again, yuy!

It also resolves some issues with infinite loops with binded values.

Base automatically changed from master to main March 16, 2021 18:13
@Dreamescaper Dreamescaper force-pushed the fix_equality_for_attributeValueHolder branch from 6e9efb3 to 2047fd3 Compare July 20, 2021 19:33
@Dreamescaper Dreamescaper mentioned this pull request Sep 18, 2021
9 tasks
/// <summary>
/// The only purpose of this method it to use it as delegate parameter.
/// </summary>
public static object This(this object @this) => @this;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😢 . I'll merge this for now but I think we'll want to have a different approach, such as a regular static method. I know it's internal, and I know it's in a different namespace. But for those reasons I think this might as well be a regular static method.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed #448 to think about this more.

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