fix(plugin): don't update props when plugin width or height props change#1406
fix(plugin): don't update props when plugin width or height props change#1406KaiVandivier merged 2 commits intomasterfrom
Conversation
| ]) | ||
| // Skip `width` and `height` props to avoid updates when changing size: | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }, [memoizedPropsToPass, inErrorState, alertsAdd, clientWidth]) |
There was a problem hiding this comment.
Won't this cause issues if width/height is provided and later removed (or vice versa)? The callbacks won't be sent to the child, even though it should switch to child-driven sizing.
There was a problem hiding this comment.
I think instead there should be a dependency here on a boolean variable !height and another !width && clientWidth, or something similar
There was a problem hiding this comment.
Yes, it will -- it's not great, but I felt okay doing this because this is how it was before, too
That's also probably an unlikely case; someone would be best off using a className or a container for changeable styles like that
There was a problem hiding this comment.
The boolean works 👌 added that!
| ]) | ||
| // Skip `width` and `height` props to avoid updates when changing size: | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }, [memoizedPropsToPass, inErrorState, alertsAdd, clientWidth]) |
There was a problem hiding this comment.
Instead of disabling the linter, what about having boolean state vars hasHeight and hasWidth and pass those instead to this effect?
There was a problem hiding this comment.
I think that would work, good suggestion 🙂
There was a problem hiding this comment.
Since height and width are props, it would take some 'prev/current' ref juggling to do
The boolean prop works though :)
|
|
Thanks for the tips; I was a bit hasty opening this 😅 Tested and still working |
## [3.13.2](v3.13.1...v3.13.2) (2025-02-11) ### Bug Fixes * **plugin:** avoid sending prop updates when height and width values change ([#1406](#1406)) ([d263c25](d263c25))
|
🎉 This PR is included in version 3.13.2 🎉 The release is available on:
Your semantic-release bot 📦🚀 |



Accidentally introduced this in 3.13.1 -- useEffect dependencies retrigger props updates, which causes unnecessary refetches in plugins
Before:
before.mov
After:
after.mov