Skip to content

Commit a1b38e9

Browse files
committed
Remove progress timers and simplify loading state messages
1 parent 42adc68 commit a1b38e9

3 files changed

Lines changed: 5 additions & 37 deletions

File tree

‎apps/editor/src/commands/code-at-cursor-commands.ts‎

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -458,21 +458,12 @@ const perform_code_at_cursor = async (params: {
458458
title: dictionary.api_call.WAITING_FOR_RESPONSE,
459459
cancellable: true
460460
},
461-
async (progress, token) => {
461+
async (_, token) => {
462462
token.onCancellationRequested(() => {
463463
cancel_token_source.cancel('User cancelled the operation')
464464
})
465465

466-
let wait_time = 0
467-
const wait_timer = setInterval(() => {
468-
progress.report({
469-
message: `${(wait_time / 10).toFixed(1)}s`
470-
})
471-
wait_time++
472-
}, 100)
473-
474466
await Promise.race([api_promise, thinking_promise])
475-
clearInterval(wait_timer)
476467
}
477468
)
478469

@@ -488,19 +479,7 @@ const perform_code_at_cursor = async (params: {
488479
cancel_token_source.cancel('User cancelled the operation')
489480
})
490481

491-
let thinking_time = 0
492-
const thinking_timer = setInterval(() => {
493-
progress.report({
494-
message: `${(thinking_time / 10).toFixed(1)}s`
495-
})
496-
thinking_time++
497-
}, 100)
498-
499-
try {
500-
await api_promise
501-
} finally {
502-
clearInterval(thinking_timer)
503-
}
482+
await api_promise
504483
}
505484
)
506485
}

‎apps/editor/src/commands/generate-commit-message-command/utils/generate-commit-message-with-api.ts‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,11 @@ export const generate_commit_message_with_api = async (params: {
3737
title: dictionary.api_call.WAITING_FOR_RESPONSE,
3838
cancellable: true
3939
},
40-
async (progress, token) => {
40+
async (_, token) => {
4141
token.onCancellationRequested(() => {
4242
cancel_token_source.cancel('Operation cancelled by user')
4343
})
4444

45-
let wait_time = 0
46-
const wait_timer = setInterval(() => {
47-
progress.report({
48-
message: `${(wait_time / 10).toFixed(1)}s`
49-
})
50-
wait_time++
51-
}, 100)
52-
5345
try {
5446
const response_result = await make_api_request({
5547
endpoint_url: params.endpoint_url,
@@ -85,8 +77,6 @@ export const generate_commit_message_with_api = async (params: {
8577
data: error
8678
})
8779
throw error
88-
} finally {
89-
clearInterval(wait_timer)
9080
}
9181
}
9282
)

‎packages/shared/src/constants/dictionary.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
export const dictionary = {
22
api_call: {
3-
WAITING_FOR_RESPONSE: 'Waiting for response',
4-
THINKING: 'Thinking',
5-
RECEIVING_RESPONSE: 'Receiving response'
3+
WAITING_FOR_RESPONSE: 'Waiting for response...',
4+
THINKING: 'Thinking...'
65
},
76

87
information_message: {

0 commit comments

Comments
 (0)