Skip to content

Fix: Fix false unsaved changes warning and repeated popup notifications#408

Merged
d4rken merged 3 commits intomainfrom
fix/profile-unsaved-changes-false-positive
Feb 24, 2026
Merged

Fix: Fix false unsaved changes warning and repeated popup notifications#408
d4rken merged 3 commits intomainfrom
fix/profile-unsaved-changes-false-positive

Conversation

@d4rken
Copy link
Copy Markdown
Member

@d4rken d4rken commented Feb 24, 2026

What changed

  • The profile edit screen no longer warns about "unsaved changes" when nothing was actually edited.
  • The case-open popup no longer randomly re-appears when AirPods stay in the same state (e.g., case continuously open).

Technical Context

  • The unsaved-changes false positive was caused by mismatched initial vs. current state: the initial snapshot was taken before navigation args were applied. Both states are now initialized from the same source and compared with a simple equality check.
  • The spurious popup re-triggers were caused by BLE signal oscillation between two addresses for the same AirPods, producing artificial open/close state transitions. Deduplication now prevents these phantom transitions from firing the popup.
  • Profile ID is now passed from the navigation key instead of SavedStateHandle, and ViewModel state is reset on exit to prevent stale data on re-entry.

In create mode, the init block pre-filled _currentState with a default
name but left _initialState empty. The hasUnsavedChanges() check saw
the non-blank name as a change, triggering the dialog on back press
even without user edits.

Set _initialState to match _currentState defaults in create mode and
unify the comparison logic to always use current != initial.
Navigation 3 doesn't auto-populate SavedStateHandle from NavKey args
like Navigation 2.x did. Pass profileId explicitly from the entry
lambda through the ScreenHost to the ViewModel via initialize().

Reset initialized flag on every exit path so re-entering a profile
reloads fresh data from the repository.
Use profile-based identity matching and cooldown keys so two BLE
signals for the same AirPods share one cooldown timer. Revert
connection monitor to show-once-per-connection behavior.
@d4rken d4rken added the bug Something isn't working label Feb 24, 2026
@d4rken d4rken merged commit 1c94354 into main Feb 24, 2026
9 checks passed
@d4rken d4rken deleted the fix/profile-unsaved-changes-false-positive branch February 24, 2026 22:17
@d4rken d4rken changed the title Fix false-positive unsaved changes dialog and popup notifications Fix: Fix false unsaved changes warning and repeated popup notifications Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant