Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Issue 2653693002: [tracing] Make tab-view rerender after reset/clear

Created:
3 years, 11 months ago by hjd
Modified:
3 years, 10 months ago
CC:
catapult-reviews_chromium.org, tracing-review_chromium.org
Target Ref:
refs/heads/master
Project:
catapult
Visibility:
Public.

Description

[tracing] Make tab-view rerender after reset/clear If you remove then re-add a subView from a tab-view within a single frame (as the memory-infra heap viewer) does then the tab-view does not re-render the tab headers. This is expected Polymer behavior since although the paths have changed the actual subView object has not so the dirty checker refuses to update the dom. You could get around this by depending directly on the correct attributes of the subView in tab-view (tabLabel etc) and using notifyPath but this doesn't work if the tab is detached when changes happen. Instead this CL wraps the subViews in a dummy object which we can recreate at will to fool the dirty checker and force the template to re-render. BUG=catapult:#2750

Patch Set 1 #

Total comments: 11

Patch Set 2 : [tracing] Make tab-view rerender after reset/clear #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+35 lines, -12 lines) Patch
M tracing/tracing/ui/base/tab_view.html View 1 4 chunks +23 lines, -12 lines 1 comment Download
M tracing/tracing/ui/base/tab_view_test.html View 1 1 chunk +12 lines, -0 lines 1 comment Download

Messages

Total messages: 12 (1 generated)
hjd
ptal, thanks! :)
3 years, 11 months ago (2017-01-23 19:14:54 UTC) #2
charliea (OOO until 10-5)
https://codereview.chromium.org/2653693002/diff/1/tracing/tracing/ui/base/tab_view.html File tracing/tracing/ui/base/tab_view.html (left): https://codereview.chromium.org/2653693002/diff/1/tracing/tracing/ui/base/tab_view.html#oldcode1 tracing/tracing/ui/base/tab_view.html:1: <!DOCTYPE html> Does this also solve https://github.com/catapult-project/catapult/issues/2754? https://codereview.chromium.org/2653693002/diff/1/tracing/tracing/ui/base/tab_view.html File ...
3 years, 11 months ago (2017-01-24 01:01:05 UTC) #3
hjd
https://codereview.chromium.org/2653693002/diff/1/tracing/tracing/ui/base/tab_view.html File tracing/tracing/ui/base/tab_view.html (left): https://codereview.chromium.org/2653693002/diff/1/tracing/tracing/ui/base/tab_view.html#oldcode1 tracing/tracing/ui/base/tab_view.html:1: <!DOCTYPE html> On 2017/01/24 01:01:04, charliea wrote: > Does ...
3 years, 11 months ago (2017-01-24 09:30:26 UTC) #4
hjd
On 2017/01/24 09:30:26, hjd wrote: > https://codereview.chromium.org/2653693002/diff/1/tracing/tracing/ui/base/tab_view.html > File tracing/tracing/ui/base/tab_view.html (left): > > https://codereview.chromium.org/2653693002/diff/1/tracing/tracing/ui/base/tab_view.html#oldcode1 > ...
3 years, 11 months ago (2017-01-24 10:40:16 UTC) #5
charliea (OOO until 10-5)
https://codereview.chromium.org/2653693002/diff/1/tracing/tracing/ui/base/tab_view.html File tracing/tracing/ui/base/tab_view.html (right): https://codereview.chromium.org/2653693002/diff/1/tracing/tracing/ui/base/tab_view.html#newcode1 tracing/tracing/ui/base/tab_view.html:1: <!DOCTYPE html> On 2017/01/24 09:30:25, hjd wrote: > On ...
3 years, 11 months ago (2017-01-24 22:46:59 UTC) #6
hjd
On 2017/01/24 22:46:59, charliea wrote: > https://codereview.chromium.org/2653693002/diff/1/tracing/tracing/ui/base/tab_view.html > File tracing/tracing/ui/base/tab_view.html (right): > > https://codereview.chromium.org/2653693002/diff/1/tracing/tracing/ui/base/tab_view.html#newcode1 > ...
3 years, 11 months ago (2017-01-25 10:36:28 UTC) #7
charliea (OOO until 10-5)
On 2017/01/25 10:36:28, hjd wrote: > Yeah :( > > I think I understand the ...
3 years, 10 months ago (2017-01-25 21:41:34 UTC) #8
charliea (OOO until 10-5)
https://codereview.chromium.org/2653693002/diff/20001/tracing/tracing/ui/base/tab_view.html File tracing/tracing/ui/base/tab_view.html (right): https://codereview.chromium.org/2653693002/diff/20001/tracing/tracing/ui/base/tab_view.html#newcode274 tracing/tracing/ui/base/tab_view.html:274: return subViews_.map((subView) => { https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions seems to suggest that ...
3 years, 10 months ago (2017-01-25 21:41:41 UTC) #9
charliea (OOO until 10-5)
https://codereview.chromium.org/2653693002/diff/20001/tracing/tracing/ui/base/tab_view_test.html File tracing/tracing/ui/base/tab_view_test.html (right): https://codereview.chromium.org/2653693002/diff/20001/tracing/tracing/ui/base/tab_view_test.html#newcode126 tracing/tracing/ui/base/tab_view_test.html:126: test('instantiate_twoTabsSwitch', function() { Does this test case actually reproduce ...
3 years, 10 months ago (2017-01-25 21:47:42 UTC) #10
hjd
On 2017/01/25 21:41:34, charliea wrote: > On 2017/01/25 10:36:28, hjd wrote: > > Yeah :( ...
3 years, 10 months ago (2017-01-26 17:33:55 UTC) #11
charliea (OOO until 10-5)
3 years, 10 months ago (2017-01-28 01:37:40 UTC) #12
AHHHHHHHHH

- thank you for making the Plunker that demonstrates the problem -

HHHHHHHHHHH! I *HATE* the tab view!

I truly have no idea what to do in this situation. The root problem here is
that, before the time that trace viewer used Polymer, it used raw Javascript to
control the DOM, and Javascript has no problem letting you treat DOM nodes as
data. Polymer, on the other hand, seems to *hate* when you treat DOM nodes as
data, and makes your life as miserable as possible when you do so. I thought I'd
figured out a sort of ugly way around this when I wrote the new tab view, but it
looks like I was wrong :-(

I can imagine the tab view working in a different way, where the analysis-view
is given a piece of data, eventSet, that it then hands to tab-view.

tab-view then does something like:

<tabs>
  <template is="dom-repeat" items="[[computeEventTypes(eventSet)]]">
    <tab on-tap="onTabTapped">[[item.friendlyName]]</tab>
  </template>
</tabs>

onTabTapped: function(item) {
  // Fire an event upwards to tell the analysis view to switch tabs.
  this.fire('onTabTapped', item);
}

The problem right now is that we're asking the tab view to treat the subviews as
data, and that's just not working at all :-( The tab view can't be responsible
for the sub view: it can only be responsible for the tabs. I can't figure out a
way to have it responsible for both in a way that doesn't involving binding
Polymer items as elements, which just doesn't work well.

Powered by Google App Engine
This is Rietveld 408576698