Skip to content

Commit d158643

Browse files
committed
fix: Add exercise with name
1 parent 13a1e7d commit d158643

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

app/components/smart/session-more-menu-component.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ export default function SessionMoreMenuComponent(props: {
6868
<Menu.Item
6969
onPress={() => {
7070
setExerciseEditorOpen(true);
71-
setEditingExerciseBlueprint(EmptyExerciseBlueprint);
71+
setEditingExerciseBlueprint(
72+
EmptyExerciseBlueprint.with({ name: 'New Exercise' }),
73+
);
7274
setMenuOpen(false);
7375
}}
7476
testID="session-add-exercise"

app/services/logger.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,26 @@ export class Logger {
1919
console.debug(message, o);
2020
}
2121

22+
time<T>(type: string, action: () => Promise<T>): Promise<T>;
2223
time(type: string, action: () => Promise<void>): Promise<void>;
2324
time(type: string, action: () => void): void;
24-
time(type: string, action: () => Promise<void> | void) {
25+
time<T>(type: string, action: () => Promise<T | void> | void) {
2526
const start = performance.now();
2627
const result = action();
2728
if (typeof result === 'undefined') {
2829
this.info(
2930
type + ' completed in ' + (performance.now() - start).toFixed(2) + 'ms',
3031
);
3132
} else {
32-
return result.then(() =>
33+
return result.then((x) => {
3334
this.info(
3435
type +
3536
' completed in ' +
3637
(performance.now() - start).toFixed(2) +
3738
'ms',
38-
),
39-
);
39+
);
40+
return x;
41+
});
4042
}
4143
}
4244
}

0 commit comments

Comments
 (0)