Don't render gr-thread-list or gr-comment-list when collapsed initially

This will prevent rendering them at initial collapsed state,
with some limitation from polymer:

When if becomes falsy, the stamped content is hidden
but not removed from dom. When if subsequently becomes
truthy again, the content is simply re-shown.

https: //polymer-library.polymer-project.org/3.0/api/elements/dom-if
Change-Id: I7d16f41dae7ba5f5c4b79aff8f0c4f6a7909df32
This commit is contained in:
Tao Zhou
2020-05-15 16:12:29 +02:00
parent f90f9f773d
commit a96173b036

View File

@@ -245,26 +245,28 @@ export const htmlTemplate = html`
</gr-button>
</div>
</template>
<template is="dom-if" if="[[!_isCleanerLogExperimentEnabled]]">
<gr-comment-list
comments="[[comments]]"
change-num="[[changeNum]]"
patch-num="[[message._revision_number]]"
project-name="[[projectName]]"
project-config="[[_projectConfig]]"
></gr-comment-list>
</template>
<template is="dom-if" if="[[_isCleanerLogExperimentEnabled]]">
<gr-thread-list
change="[[change]]"
hidden$="[[!commentThreads.length]]"
threads="[[commentThreads]]"
change-num="[[changeNum]]"
logged-in="[[_loggedIn]]"
hide-toggle-buttons
on-thread-list-modified="_onThreadListModified"
>
</gr-thread-list>
<template is="dom-if" if="[[_expanded]]">
<template is="dom-if" if="[[!_isCleanerLogExperimentEnabled]]">
<gr-comment-list
comments="[[comments]]"
change-num="[[changeNum]]"
patch-num="[[message._revision_number]]"
project-name="[[projectName]]"
project-config="[[_projectConfig]]"
></gr-comment-list>
</template>
<template is="dom-if" if="[[_isCleanerLogExperimentEnabled]]">
<gr-thread-list
change="[[change]]"
hidden$="[[!commentThreads.length]]"
threads="[[commentThreads]]"
change-num="[[changeNum]]"
logged-in="[[_loggedIn]]"
hide-toggle-buttons
on-thread-list-modified="_onThreadListModified"
>
</gr-thread-list>
</template>
</template>
</div>
</template>