fix(SUP-52427): prevent infinite setState loop in Watermark component [HF v0.83.6] - #1171
Open
MosheMaorKaltura wants to merge 5 commits into
Open
fix(SUP-52427): prevent infinite setState loop in Watermark component [HF v0.83.6]#1171MosheMaorKaltura wants to merge 5 commits into
MosheMaorKaltura wants to merge 5 commits into
Conversation
…eDimension componentDidUpdate called _loadImageDimension unconditionally, which called setState inside img.onload, triggering another componentDidUpdate — causing an infinite loop of re-renders and repeated HTTP requests for the watermark image. Fix: call _loadImageDimension once in componentDidMount for the initial load, and in componentDidUpdate only when the image URL actually changes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
lianbenjamin
approved these changes
May 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hotfix for v0.83.6
Backport of #1170 targeting the
v0.83.6release tag.Problem
componentDidUpdatecalled_loadImageDimension()unconditionally on every render. Inside_loadImageDimension,img.onloadcallssetState({imgWidth, imgHeight}), which triggers anothercomponentDidUpdate— creating an infinite loop of re-renders and repeated HTTP requests for the watermark image.The loop was introduced in feat(FEC-14949) #1160 which moved
_loadImageDimensionfromcomponentWillMountintocomponentDidUpdatewithout adding a guard.Observed: Watermark image URL requested 2000+ times per session. Reproduces after a few seek operations on the player.
Fix
componentDidMount(after_handleWatermarkUrl), so staticconfig.imgURLs load dimensions on mount.componentDidUpdateto only call_loadImageDimensionwhen the image URL actually changes — prevents the setState feedback loop.Test page
Verified with local reproduction pages:
🤖 Generated with Claude Code