Skip to content

Commit 4937e54

Browse files
committed
fix(amazonq): fix flickering issue for model selection dropdown and agenticCoding toggle (aws#2065)
* fix(amazonq): fix flickering issue for modelId and agenticCoding * fix(amazonq): Fixing flaky tests
1 parent ab549c5 commit 4937e54

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

chat-client/src/client/mynahUi.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ describe('MynahUI', () => {
260260
sinon.assert.calledThrice(updateStoreSpy)
261261
})
262262

263-
it('should create a new tab if current tab is loading', () => {
263+
it('should create a new tab if current tab is loading', function (done) {
264+
this.timeout(8000)
264265
// clear create tab stub since set up process calls it twice
265266
createTabStub.resetHistory()
266267
getAllTabsStub.returns({ 'tab-1': { store: { loadingChat: true } } })
@@ -274,6 +275,7 @@ describe('MynahUI', () => {
274275

275276
sinon.assert.calledOnceWithExactly(createTabStub, false)
276277
sinon.assert.calledThrice(updateStoreSpy)
278+
done()
277279
})
278280

279281
it('should not create a new tab if one exists already', () => {

chat-client/src/client/mynahUi.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,20 @@ export const handlePromptInputChange = (mynahUi: MynahUI, tabId: string, options
151151
}
152152
}
153153

154+
const updatedPromptInputOptions = promptInputOptions?.map(option => {
155+
option.value = optionsValues[option.id]
156+
return option
157+
})
158+
154159
mynahUi.updateStore(tabId, {
155-
promptInputOptions: promptInputOptions?.map(option => {
156-
option.value = optionsValues[option.id]
157-
return option
158-
}),
160+
promptInputOptions: updatedPromptInputOptions,
161+
})
162+
163+
// Store the updated values in tab defaults for new tabs
164+
mynahUi.updateTabDefaults({
165+
store: {
166+
promptInputOptions: updatedPromptInputOptions,
167+
},
159168
})
160169
}
161170

@@ -414,6 +423,12 @@ export const createMynahUi = (
414423
}
415424

416425
const tabStore = mynahUi.getTabData(tabId).getStore()
426+
const storedPromptInputOptions = mynahUi.getTabDefaults().store?.promptInputOptions
427+
428+
// Retrieve stored model selection and pair programming mode from defaults
429+
if (storedPromptInputOptions) {
430+
defaultTabConfig.promptInputOptions = storedPromptInputOptions
431+
}
417432

418433
// Tabs can be opened through different methods, including server-initiated 'openTab' requests.
419434
// The 'openTab' request is specifically used for loading historical chat sessions with pre-existing messages.

0 commit comments

Comments
 (0)