Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions addon/components/hyper-table-v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,20 @@ export default class HyperTableV2 extends Component<HyperTableV2Args> {
@tracked scrollableTable: boolean = false;
@tracked initialFetchColumnsDone: boolean = false;
@tracked initialLoadAnimationActive: boolean = false;
@tracked initialLoadAnimationPlayed: boolean = false;

private initialLoadAnimationPlayed: boolean = false;
private initialLoadAnimationTimeout?: number;

declare private hypertableInstanceID: string;

constructor(owner: unknown, args: HyperTableV2Args) {
super(owner, args);
args.handler.fetchColumnDefinitions();
this.activateInitialLoadAnimationIfNeeded();
args.handler.fetchColumns().then(() => {
this.initialFetchColumnsDone = true;
args.handler.fetchRows().finally(() => {
this.activateInitialLoadAnimationIfNeeded();
this.finalizeInitialLoadAnimation();
});
this.computeScrollableTable();
});
Expand Down Expand Up @@ -280,12 +281,19 @@ export default class HyperTableV2 extends Component<HyperTableV2Args> {
return;
}

if (this.args.handler.communicationError || this.args.handler.rows.length === 0) {
this.initialLoadAnimationPlayed = true;
this.initialLoadAnimationActive = true;
}

private finalizeInitialLoadAnimation(): void {
if (!this.initialLoadAnimationActive || !this.initialLoadAnimation) {
return;
}

this.initialLoadAnimationPlayed = true;
this.initialLoadAnimationActive = true;
if (this.args.handler.communicationError || this.args.handler.rows.length === 0) {
this.initialLoadAnimationActive = false;
return;
}

const rowsAnimationWindowMs = Math.max(this.args.handler.rows.length - 1, 0) * this.initialLoadAnimation.staggerMs;
const activeDurationMs =
Expand Down
Loading