Bluetooth settings icon doesn't update on the first toggle click |
||||||
Issue descriptionWhen 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
,
Oct 17
Does this happen both with --enable-features=Polymer2 and --disable-features=Polymer2 ? Can you bisect with tools/bisect-builds.py ?
,
Oct 17
Correction: --enable-features=WebUIPolymer2 and --disable-features=WebUIPolymer2
,
Oct 18
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.
,
Oct 18
,
Oct 18
Seems to be a problem regardless of the flag. I'll take a look.
,
Oct 18
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.
,
Oct 18
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
,
Oct 18
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
,
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
,
Oct 18
@ortuno: Do you think this should/could be merged to M71?
,
Oct 19
Yes, since this is a regression. I'll wait for canary to verify and then request a merge. |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by r...@chromium.org
, Oct 17Owner: ortuno@chromium.org