Dynamically calculate episode row height on LazyEpisodeTable init #3842
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.
Brief summary
Instead of using a fixed size for episodeRowHeight, it is given a default value but recalculated when the episode table is mounted.
Which issue is fixed?
This fixes #3511. While this is marked as related to #3013, I believe they're not actually related.
In-depth Description
The bug was reproduced by manually setting the root font-size to a larger value (I suspected that this might be reason, because the reporter mentioned system scale changes).
The original code hardcodes episodeRowHeight value to 176 px (which is indeed the row height when the root font size is the default 16px). episodeRowHeight is used to make scroll calculations to decide which episodes to mount, and when it is different from the actual value, it results in mounting incorrect episodes.
The fix determines episodeRowHeight from the actual dom element of the first episode (or from the "no-episodes" element, if no episodes exist), which fixes the issue above.
How have you tested this?
Used Chrome settings to change the root font-size value, and ensured scrolling worked OK after reloading the page.
note: this fix doesn't automatically react to changes in the root font-size - it only recalculates episodeRowHeight in the init() function. I can make it reactive, but it seems unnecessary, as this is not something that users play with frequently.