New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 896509 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Oct 18
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Bug



Sign in to add a comment

Bluetooth settings icon doesn't update on the first toggle click

Project Member Reported by jordynass@chromium.org, Oct 17

Issue description

When I click the bluetooth toggle in settings for the first time, it toggles the bluetooth status but the icon doesn't change. Each subsequent click toggles both the bluetooth status and the icon so they are always out of sync after the first toggle.

Screenshots:
http://screen/DQZtJbJfiGw
http://screen/qWvDrRaXwOV

This paste shows the logs with my interactions (in caps, prefaced by '>>>')

https://paste.googleplex.com/5276170304094208
 
Cc: r...@chromium.org
Owner: ortuno@chromium.org
Does this happen both with --enable-features=Polymer2 and --disable-features=Polymer2 ?

Can you bisect with tools/bisect-builds.py ?
Correction:
--enable-features=WebUIPolymer2 and --disable-features=WebUIPolymer2
I'm dealing with another P1 right now so I don't have time to experiment but it was happening from HEAD when I ran it. I don't think I set either of those flags.

It happened on a colleague's Chromebook as well so I think it should be easy to repro.
Labels: OS-Chrome
Status: Started (was: Untriaged)
Seems to be a problem regardless of the flag. I'll take a look.
Labels: Needs-Bisect
There is a two-way binding that is misbehaving.

<iron-icon icon="[[getIcon_(bluetoothToggleState_)]]"></iron-icon>
<cr-toggle id="enableBluetooth" checked="{{bluetoothToggleState_}}"
</cr-toggle>

When cr-toggle changes states, getIcon_ gets called without bluetoothToggleState_ actually being updated so we return the wrong icon. There haven't been any changes to the Bluetooth code in a while so I'm suspecting something changed at a lower layer.

This worked on m70 I'll ask for bisect to try to narrow down what changed.
Repro steps for the bisect:

1. Open chrome://settings
2. Scroll down to bluetooth
3. Click the Toggle

Expected:
If it changed to Powered On, the icon should be like [1]. If it changed to Powered Off, the icon should be like [2].

Actual:
If it changes to Powered On, the icon is like [2], and if it changes to Powered Off, the icon is like [1].

[1] https://www.materialui.co/icon/bluetooth
[2] https://www.materialui.co/icon/bluetooth-disabled
Indeed this a race condition between when Polymer calls observers (getIcon_() in this case), and when it updates two-way bound variables. An easy way to see this is to add a 
console.log() statement  at [1] within the getIcon_() observer comparing the observer's parameter (which has the correct value) to this.bluetoothToggleState_ which has not been updated yet (has the previous value).

The following fixes it https://chromium-review.googlesource.com/c/chromium/src/+/1289410.

@ortuno: Do you already have a fix out? If not I can send this one for review.


[1] https://cs.chromium.org/chromium/src/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js?type=cs&g=0&l=168
Project Member

Comment 10 by bugdroid1@chromium.org, Oct 18

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/861cf56d6f6cbf4dff06e34139f1e2a97132aae0

commit 861cf56d6f6cbf4dff06e34139f1e2a97132aae0
Author: dpapad <dpapad@chromium.org>
Date: Thu Oct 18 22:47:23 2018

ChromeOS Settings: Fix bluetooth icon updating.

There is a race condition between when Polymer calls observers and when it
updates a two-way bound variable in the parent element.

Bypass the isuse by using the observers parameter instead.

Bug:  896509 
Change-Id: I63b13c858b62214d7973af641f67c659de9ea674
Reviewed-on: https://chromium-review.googlesource.com/c/1289410
Reviewed-by: Giovanni Ortuño Urquidi <ortuno@chromium.org>
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600951}
[modify] https://crrev.com/861cf56d6f6cbf4dff06e34139f1e2a97132aae0/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js

Cc: -dpa...@chromium.org ortuno@chromium.org
Owner: dpa...@chromium.org
Status: Fixed (was: Started)
@ortuno: Do you think this should/could be merged to M71?
Labels: -Needs-Bisect
Yes, since this is a regression. I'll wait for canary to verify and then request a merge.

Sign in to add a comment