fix: stabilize carousel cpu perf on idle#968
fix: stabilize carousel cpu perf on idle#968utkarshdalal merged 1 commit intoutkarshdalal:masterfrom
Conversation
📝 WalkthroughWalkthroughThis change refactors LibraryCarouselPane to centralize layout calculations by introducing a Changes
Estimated Code Review Effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly Related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
snapshot layout on idle to prevent redraws at hz rate which causes high cpu usage on render thread and lock up after extended idle on center focused item.
Summary by cubic
Stabilized the library carousel by snapshotting layout metrics and computing the centered item from a consistent source. This removes flicker and incorrect centering during initial load and scrolling.
CarouselLayoutSnapshotand aproduceState+snapshotFlow(...).distinctUntilChanged()to capture viewport center/span, visible item centers, and first/last visible indexes.listState.layoutInforeads with the snapshot to avoid transient values causing jitter.Written for commit 222f298. Summary will update on new commits.
Summary by CodeRabbit