Skip to content

manager: Reduce recomposition on the home screen#3180

Merged
YuKongA merged 3 commits into
tiann:mainfrom
YunZiA:recomposition
Jan 24, 2026
Merged

manager: Reduce recomposition on the home screen#3180
YuKongA merged 3 commits into
tiann:mainfrom
YunZiA:recomposition

Conversation

@YunZiA

@YunZiA YunZiA commented Jan 23, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@YuKongA

YuKongA commented Jan 24, 2026

Copy link
Copy Markdown
Collaborator

曲线咋给我删了

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to reduce recomposition on the home screen by optimizing the back handler logic. The changes extract the navigation back handler into a separate composable function and use derivedStateOf to minimize unnecessary recompositions when pager state changes.

Changes:

  • Refactored back handler logic into a separate MainScreenBackHandler composable function
  • Wrapped the back handler enabled condition in derivedStateOf with remember to reduce recompositions
  • Changed from currentPage to targetPage for determining if the back handler should be enabled
  • Removed animation spec parameter from animateScrollToPage call and unused animation imports

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread manager/app/src/main/java/me/weishu/kernelsu/ui/MainActivity.kt Outdated
Comment thread manager/app/src/main/java/me/weishu/kernelsu/ui/MainActivity.kt Outdated
@YunZiA

YunZiA commented Jan 24, 2026

Copy link
Copy Markdown
Contributor Author

你加回来嘛,没注意> 曲线咋给我删了

YuKongA and others added 2 commits January 24, 2026 10:06
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@YuKongA YuKongA changed the title manager:Reduce recomposition on the home screen manager: Reduce recomposition on the home screen Jan 24, 2026
@YuKongA YuKongA merged commit 2764fc0 into tiann:main Jan 24, 2026
KOWX712 pushed a commit to KOWX712/KernelSU that referenced this pull request Jan 25, 2026
Co-authored-by: YuKongA <70465933+YuKongA@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants