Skip to content

Onboarding state is lost on configuration change due to variables in MainActivity #127

@moehamade

Description

@moehamade

Checklist

  • I am able to reproduce the bug with the latest version given here: CLICK THIS LINK.
  • I made sure that there are no existing issues - open or closed - which I could contribute my information to.
  • I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
  • This issue contains only one bug.
  • I have read and understood the contribution guidelines.

Affected version

0.7

Steps to reproduce the bug

Steps to reproduce the bug

  1. Launch the app fresh (first install or after clearing storage)
  2. Begin onboarding
  3. Switch to Light Mode or Dark Mode
  4. Observe that the onboarding progress is lost and restarts or behaves unexpectedly

Expected behavior

The app should preserve the onboarding state and internal flags (e.g. onboardingState, isBluetoothLoading, etc.) across configuration changes such as screen rotation.

Actual behavior

Activities get recreated on configuration change;
Since all onboarding-related state variables are stored as mutable variables inside MainActivity (e.g. var onboardingState by mutableStateOf(...)), they are lost during configuration changes. The onboarding flow resets or behaves inconsistently.

Screenshots/Screen recordings

Screen_recording_20250714_223146.mp4

Affected Android/Custom ROM version

No response

Affected device model

No response

Additional information

This issue is caused by storing non-persisted UI state (like onboardingState, isBluetoothLoading, bluetoothStatus, etc.) inside MainActivity.
Since MainActivity gets recreated on configuration change, all these variables are reset unless manually saved and restored (e.g. via rememberSaveable, SavedStateHandle, or ViewModel).
A recommended solution would be to move the state into a ViewModel and persist it since ViewModels survive configuration changes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions