Refactored comments to hoist TooltipProvider to the list level#28401
Draft
9larsons wants to merge 2 commits into
Draft
Refactored comments to hoist TooltipProvider to the list level#284019larsons wants to merge 2 commits into
9larsons wants to merge 2 commits into
Conversation
Each comment row rendered its own Radix TooltipProvider instances inside CommentHeader (timestamp + commenting-disabled indicator) and inside every CommentMetrics Metric (replies, likes, dislikes, reports), giving ~4-6 provider contexts per row. With the virtualized list showing ~20 rows that's 80-120 provider instances, none of which coordinate tooltip timing (skipDelayDuration only applies within a single provider). Wrap the comments list once in a single TooltipProvider and drop the per-row providers. The thread sidebar reuses CommentHeader/CommentMetrics and renders within the same React subtree (context flows through the Sheet portal), so it is covered by the same provider. Rebases the stale approach from #25771 onto the current component structure; the original diff predates the comments overhaul that split comments-list.tsx into sub-components. ref #25771
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
What
Rebases the optimization from #25771 onto the current Comments structure. That PR predates the Comments overhaul that split
comments-list.tsxinto sub-components, so its original diff no longer applies cleanly — but the underlying concern survived the refactor and actually got worse.Each comment row currently renders its own Radix
TooltipProviderinstances:CommentHeader— timestamp tooltip + commenting-disabled indicatorCommentMetrics— one perMetric(Replies, Likes, Dislikes, Reports)That's ~4–6 provider contexts per row. With the virtualized list showing ~20 rows, that's 80–120 provider instances, none of which coordinate tooltip timing (
skipDelayDurationonly applies within a single provider, so hover delays don't share state across them).Changes
TooltipProvider(comments-list.tsx).comment-header.tsxandcomment-metrics.tsx.CommentHeader/CommentMetricsand renders within the same React subtree (context flows through the RadixSheetportal via the React tree), so it stays covered by the same provider.Net: ~80–120 provider contexts → 1, plus consistent hover-delay behavior across a row's tooltips. No UI/behavior change.
Tests
comment-header.test.tsxto render within aTooltipProvider, mirroring how the app now supplies it at the list level.Rebases / supersedes #25771.