Commit f9fb6707 authored by Sam McNally's avatar Sam McNally Committed by Commit Bot

Don't toggle image-dominant when the data model is empty.

When adjusting the search parameters, the data model briefly has no
entries. Updating the image-dominant calculation during this interval
causes the image-dominant to be disabled, causing a flicker of the file
names if the contents is image-dominant.

Bug: 483718
Change-Id: I099a013e5f05c36902be67aeffc40edbc718be26
Reviewed-on: https://chromium-review.googlesource.com/c/1341736
Commit-Queue: Sam McNally <sammc@chromium.org>
Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609228}
parent cafc3969
...@@ -669,6 +669,14 @@ FileGrid.prototype.setImportStatusVisible = function(visible) { ...@@ -669,6 +669,14 @@ FileGrid.prototype.setImportStatusVisible = function(visible) {
* @private * @private
*/ */
FileGrid.prototype.onSplice_ = function() { FileGrid.prototype.onSplice_ = function() {
// When adjusting search parameters, |dataModel| is transiently empty.
// Updating whether image-dominant is active at these times can cause spurious
// changes. Avoid this problem by not updating whether image-dominant is
// active when |dataModel| is empty.
if (this.dataModel.getFileCount() == 0 &&
this.dataModel.getFolderCount() == 0) {
return;
}
this.classList.toggle('image-dominant', this.dataModel.isImageDominant()); this.classList.toggle('image-dominant', this.dataModel.isImageDominant());
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment