Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 3377dbd

Browse files
committed
DEV: consolidate in method and always reset before suggesting
1 parent aab759d commit 3377dbd

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

assets/javascripts/discourse/components/modal/diff-modal.gjs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ export default class ModalDiffModal extends Component {
114114

115115
@action
116116
async suggestChanges() {
117-
this.smoothStreamer.resetStreaming();
118-
this.diffStreamer.reset();
117+
this.#resetState();
119118

120119
try {
121120
this.loading = true;
@@ -161,12 +160,16 @@ export default class ModalDiffModal extends Component {
161160

162161
@action
163162
closeAndCleanup() {
163+
this.#resetState();
164+
this.loading = false;
165+
this.args.closeModal();
166+
}
167+
168+
#resetState() {
164169
this.suggestion = "";
165170
this.finalResult = "";
166171
this.smoothStreamer.resetStreaming();
167172
this.diffStreamer.reset();
168-
this.loading = false;
169-
this.args.closeModal();
170173
}
171174

172175
<template>

0 commit comments

Comments
 (0)