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

useControlHandlers cause unnecessary rerenders? #3171

Open
seriusokhatsky opened this issue Apr 26, 2024 · 1 comment
Open

useControlHandlers cause unnecessary rerenders? #3171

seriusokhatsky opened this issue Apr 26, 2024 · 1 comment
Labels
question Further information is requested

Comments

@seriusokhatsky
Copy link

Hello team,

I investigated Stackable performance and noticed that some elements are rendered constantly. I checked the code and found that you use useControlHandlers and useBlockAttributesContext hooks for attributes in your controls, for example. If I understood correctly, these hooks should make a particular control render only if a particular attribute is changed, and it should work great.

However, when I performed my tests with console.log, I noticed that controls are rendered even if non-related attributes are changed. It may not be the right way to check this (with console.log). But I would be very grateful if you could explain to me why it works like that.

HOW TO REPRODUCE

  1. Case with useControlHandlers hook inside AdvancedSelectControl. Here is a video that shows that when I change button style attribute, control for "Hover effect" also renders.
    Just add console.log to the component and try to change some element options.

image
image

  1. Without useControlHandlers. Just make value and onChange constant (break the control functionality).

image
image

As you can see, it doesn't call the consol.log function so I suppose that it also doesn't rerender the component.
Is something broken, or are my tests not correct?

Thank you for your time.

@seriusokhatsky seriusokhatsky added the question Further information is requested label Apr 26, 2024
@seriusokhatsky
Copy link
Author

@bfintal can you check this please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant