(core) Removing conditional styles for blank rows

Summary:
When grid view was not fully loaded the initial blank row
was marked as invalid by conditional styles. This removes the styling
when row is not fully loaded.

Test Plan: Tested manually

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3392
This commit is contained in:
Jarosław Sadziński 2022-04-20 17:57:44 +02:00
parent 77ef9df27d
commit bedb19f9c7

View File

@ -445,6 +445,9 @@ export class FieldBuilder extends Disposable {
// and wait for the update. // and wait for the update.
const computedRule = koUtil.withKoUtils(ko.pureComputed<ComputedStyle>(() => { const computedRule = koUtil.withKoUtils(ko.pureComputed<ComputedStyle>(() => {
if (this.isDisposed()) { return null; } if (this.isDisposed()) { return null; }
// If this is add row or a blank row (not loaded yet with all fields = '')
// don't use rules.
if (row._isAddRow() || !row.id()) { return null; }
const styles: Style[] = this.field.rulesStyles(); const styles: Style[] = this.field.rulesStyles();
// Make sure that rules where computed. // Make sure that rules where computed.
if (!Array.isArray(styles) || styles.length === 0) { return null; } if (!Array.isArray(styles) || styles.length === 0) { return null; }