Skip to content

Commit e4525ba

Browse files
committed
WIP logging to figure out custom column race condition
1 parent 9d6e029 commit e4525ba

4 files changed

Lines changed: 13 additions & 2 deletions

File tree

packages/dashboard-core-plugins/src/panels/IrisGridPanel.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ import {
105105
emitLinkPointSelected,
106106
emitLinkSourceDataSelected,
107107
} from '../linker/LinkerEvent';
108+
import { flushSync } from 'react-dom';
108109

109110
const log = Log.module('IrisGridPanel');
110111

@@ -817,6 +818,7 @@ export class IrisGridPanel extends PureComponent<
817818
const panelId = LayoutUtils.getIdFromPanel(this);
818819
assertNotNull(panelId);
819820
emitFilterColumnsChanged(glEventHub, panelId, columns);
821+
flushSync(() => {});
820822
}
821823

822824
startModelListening(model: IrisGridModel): void {

packages/iris-grid/src/IrisGrid.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ import type ColumnHeaderGroup from './ColumnHeaderGroup';
194194
import { IrisGridThemeContext } from './IrisGridThemeProvider';
195195
import { isMissingPartitionError } from './MissingPartitionError';
196196
import { NoPastePermissionModal } from './NoPastePermissionModal';
197+
import { flushSync } from 'react-dom';
197198

198199
const log = Log.module('IrisGrid');
199200

@@ -3462,7 +3463,9 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
34623463
`change moved columns for removed custom columns`,
34633464
newMovedColumns
34643465
);
3465-
this.setState({ movedColumns: newMovedColumns });
3466+
flushSync(() => {
3467+
this.setState({ movedColumns: newMovedColumns });
3468+
});
34663469
}
34673470
if (!deepEqual(selectDistinctColumns, newSelectDistinctColumns)) {
34683471
log.debug(
@@ -3473,7 +3476,9 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
34733476
}
34743477
}
34753478

3476-
this.setState({ customColumns });
3479+
flushSync(() => {
3480+
this.setState({ customColumns });
3481+
});
34773482
if (customColumns.length > 0) {
34783483
// If there are no custom columns, the change handler never fires
34793484
// This causes the loader to stay until canceled by the user

packages/iris-grid/src/IrisGridModelUpdater.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ function IrisGridModelUpdater({
152152
);
153153
useOnChange(
154154
function updateViewport() {
155+
console.log('updating viewport', columns?.at(-1));
155156
model.setViewport(top, bottom, columns);
156157
},
157158
[model, top, bottom, columns]

packages/iris-grid/src/IrisGridTableModelTemplate.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,6 +1173,7 @@ class IrisGridTableModelTemplate<
11731173
};
11741174

11751175
const { columns } = data;
1176+
console.log(data, columns);
11761177
for (let r = 0; r < data.rows.length; r += 1) {
11771178
const row = data.rows[r];
11781179
const newRow = this.extractViewportRow(row, columns);
@@ -1374,6 +1375,8 @@ class IrisGridTableModelTemplate<
13741375
top,
13751376
bottom
13761377
);
1378+
console.log('apply viewport', columns?.at(-1));
1379+
console.trace();
13771380
this.applyBufferedViewport(viewportTop, viewportBottom, columns);
13781381
},
13791382
APPLY_VIEWPORT_THROTTLE,

0 commit comments

Comments
 (0)