Closed Bug 941909 Opened 8 years ago Closed 8 years ago

[Clock] Alarm toggle operation blocks future toggling

Categories

(Firefox OS Graveyard :: Gaia::Clock, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jugglinmike, Assigned: jugglinmike)

Details

Attachments

(1 file)

The list item representation of an alarm updates immediately in response to tapping on the "enabled" toggle switch. This means the visual state of the application can go out-of-sync with the underlying model. I'm suggesting that we prevent the toggle switch from updating until the database operation has either succeeded or failed.
After talking this over with Rick, Eric, and Corey, I'm convinced that an "optimistic" UI is acceptable. The real problem is that the code ignores new "toggle" operations if a "toggle" operation is already pending. This behavior (coupled with an optimistic UI) means that the UI may communicate changes that the system does not recognize.

This bug is difficult to reproduce without modifying the code because it concerns a race condition in a database operation that is very rapid under ideal circumstances:

1. Open the Clock application
2. Create an alarm
3. Rapidly tap the "enabled" checkbox twice

Expected result: the checkbox becomes disabled and then re-enabled.

Actual result: the checkbox becomes disabled, enabled, and then becomes disabled.
Summary: [Clock] Alarm active toggle updates optimistically → [Clock] Alarm toggle operation blocks future toggling
Attachment #8336463 - Flags: review?(gnarf37)
I also submitted the above as a pull request on GitHub to help verify that all the tests pass: https://github.com/mozilla-b2g/gaia/pull/13931
Assignee: nobody → mike
Comment on attachment 8336463 [details] [diff] [review]
941909-concurrent-checkbox.patch

Review of attachment 8336463 [details] [diff] [review]:
-----------------------------------------------------------------

r=me
Attachment #8336463 - Flags: review?(gnarf37) → review+
master: https://github.com/mozilla-b2g/gaia/commit/afc5cc73ecc665a0040f8c118daac8bb862ea698

Thanks for the review, Corey!
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.