Skip to content

Commit 0d7672a

Browse files
Delay for UI change before training model (#384)
I think this is worth it for now. I'd like to revisit moving the work off the UI thread in the longer term.
1 parent bf85d97 commit 0d7672a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/store.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,9 @@ const createMlStore = (logging: Logging) => {
498498
trainModelDialogStage: TrainModelDialogStage.TrainingInProgress,
499499
trainModelProgress: 0,
500500
});
501+
// Delay so we get UI change before training starts. The initial part of training
502+
// can block the UI. 50 ms is not sufficient, so use 100 for now.
503+
await new Promise((res) => setTimeout(res, 100));
501504
const trainingResult = await trainModel({
502505
data: gestures,
503506
onProgress: (trainModelProgress) =>

0 commit comments

Comments
 (0)