Skip to content

Conversation

@dogi
Copy link
Member

@dogi dogi commented Nov 10, 2025

  • Moved non-critical initializations from onCreate to onStart.
  • Introduced postponeEnterTransition() and reportFullyDrawn() for faster UI rendering.
  • Batched heavy tasks into a background coroutine to prevent blocking the main thread.

https://jules.google.com/session/5972562439060210828

- Moved non-critical initializations from onCreate to onStart.
- Introduced postponeEnterTransition() and reportFullyDrawn() for faster UI rendering.
- Batched heavy tasks into a background coroutine to prevent blocking the main thread.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +145 to 156
override fun onStart() {
super.onStart()
lifecycleScope.launch(Dispatchers.IO) {
setupHeavyTasks()
}
}

private fun setupHeavyTasks() {
setupNavigation()
setupRealmListeners()
challengeHelper = ChallengeHelper(this, mRealm, user, settings, editor, dashboardViewModel)
challengeHelper.evaluateChallengeDialog()

Choose a reason for hiding this comment

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

P0 Badge Avoid running Realm/UI setup on Dispatchers.IO

The new onStart coroutine uses Dispatchers.IO to invoke setupHeavyTasks(), but that method still calls setupRealmListeners() and creates ChallengeHelper. Both rely on the activity’s mRealm (instantiated on the main thread in SyncActivity.onCreate) and immediately interact with fragments when evaluateChallengeDialog() shows dialogs. Realm objects are thread-confined and fragment operations must run on the main thread, so executing them on the IO dispatcher will crash with IllegalStateException or CalledFromWrongThreadException as soon as the activity starts. These calls need to stay on the main thread or use a background Realm instance and post UI work back to the main dispatcher.

Useful? React with 👍 / 👎.

@dogi dogi added the close? label Nov 10, 2025
@dogi dogi closed this Nov 10, 2025
@dogi dogi reopened this Nov 10, 2025
@dogi dogi removed the close? label Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants