Files
gerrit/polygerrit-ui/app/elements/change/gr-account-list
Wyatt Allen 3f8bdcc65d Nest gr-account-list's chips dom-repeat in a div for race-condition
As the PolyGerrit change view makes API requests to load a change, in
rare cases, the API server will take so long to respond with the server
config (at /config/server/info) that it will not arrive until after the
change detail (at /changes/##/detail) has resolved. This slowness falls
within normal fluctuations of responsiveness according to server load.

However, as PolyGerrit renders UI in response to APIs coming in, this
rare, unusual order of request resolution times causes a chain of
Polymer computation effects that results in a DOM manipulation
exception. This exception prevents complete rendering of the reply
dialog; namely it fails to render the CC list element.

When a user clicks on the [Submit] button for a change with a broken
reply dialog, the handler checks whether the CC list should have
appeared in the UI (by checking whether NoteDB is enabled in the server
config). If it sees that it should, it attempts to extract the added CC
entries from the list which has not rendered -- resulting in another
exception, which, this time, prevents any reply from being submitted.

The chain of computation effects that result in the initial rendering
error is indirect. When initializing a gr-autocomplete-dropdown, the
suggestion list is initialized to an empty set. Any change in the
suggestion list triggers a recomputation of the suggestion elements (of
which there are none). Querying for the suggestion elements is preceded
by a Polymer.dom.flush() call in order to ensure that they have been
rendered.

When this process flushes the DOM, one of the operations that is queued
will be to render the chips in a gr-account-list's dom-repeat. When
rendering, each instantiated chip is prepended to that element's tree
using a native .insertBefore call with the new chip being passed as the
first parameter and the dom-repeat being passed as the second parameter.
However, for some reason, the dom-repeat's parentElement registers as
null at this point, resulting in the DOM exception.

Nesting the dom-repeat in a div results in the correct parentElement
reference in this case.

Bug: Issue 6419
Change-Id: Ic5a07f0e168285d9baf35126609ecce8df2941a7
2017-07-24 11:31:54 -07:00
..