-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix settings panel reset during state update #1051
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix settings panel reset during state update #1051
Conversation
|
0a3af39 to
a3b29a6
Compare
a3b29a6 to
a62e6a7
Compare
a62e6a7 to
06382ca
Compare
|
Maybe it should warn you if you switch profiles or leave the settings tab with unsaved changes? |
We might want to use https://ui.shadcn.com/docs/components/alert-dialog I can make it look at little bit nicer / less heavy-handed. |
simply adjusted the transparency and it looks good now. |
Looks nice! |
581eb48 to
aeda74b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a blocker, but we might want to use the official shadcn version of this component:
npx shadcn@latest add alert-dialogThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many radix-ui components are already in use, it also provides an Alert Dialog, and we only use the Dropdown from the vscrui , I’m considering switching these to radix-ui.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@System233 i think we can use shadcn too, shadcn built on radix-ui with tailwind theme support, and @cte already config theme for tailwind and shadcn component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@System233 i think we can use shadcn too, shadcn built on radix-ui with tailwind theme support, and @cte already config theme for tailwind and shadcn component
The shadcn works way is better than I expected, thanks for reminder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this test is failing:
● SettingsView - Allowed Commands › saves allowed commands when clicking Save
expect(jest.fn()).toHaveBeenCalled()
Expected number of calls: >= 1
Received number of calls: 0
328 | }),
329 | )
> 330 | expect(onDone).toHaveBeenCalled()
| ^
331 | })
332 | })
333 |
at Object.<anonymous> (src/components/settings/__tests__/SettingsView.test.tsx:330:18)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reminds me that there are still some fields that have not been snapshotted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit-pick: I'd probably name these something like:
inputEventTransformdropdownEventTransformnoTransform
I think this makes it clear that they are transform function rather than actual event handlers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
cte
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! I tested this locally and it's a big improvement IMO. We just need to fix the one failing test.
I left some non-blocking feedback; feel free to ignore.
aeda74b to
6cf19b6
Compare
|
Adjusted the following UI to make it compatible with all themes Unit-testI added mock data to api_conversation_history.json and then I got this |
3ec352a to
6cf19b6
Compare
|
Tests are flaky/broken in main unfortunately |
mrubens
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I'm not sure about changing this to a slider - not all of the providers have the same 0-2 range. And separately, I'm noticing an error where the value gets reset to 1.
Screen.Recording.2025-02-19.at.9.09.17.PM.mov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just leave as a text input for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure. 1 is the default value, other values can also be the default values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
range 0-2 comes from the parent component, and default value is set when isCustomTemperature is toggled, these behaviors are the same as before the change, is it really bad after changing to a slider?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bandicam.2025-02-20.10-50-09-663.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I guess I was confused since 0 used to be the default value. I don't feel super strongly against the slider and it's certainly nicer in some ways, I just think it implies a valid range of 0-2 that's not the case for all models.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I guess I was confused since 0 used to be the default value. I don't feel super strongly against the slider and it's certainly nicer in some ways, I just think it implies a valid range of 0-2 that's not the case for all models.
I'm not sure either, I didn't change maxValue, and I've restored the default value to 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you like the slider better let’s go for it then
|
Actually I'm seeing some weirdness on rename now as well Screen.Recording.2025-02-19.at.9.12.18.PM.mov |
It was fine before, I'll fix it |
6cf19b6 to
13c902a
Compare
|
Rename seems to be working better, thanks! Looks like just one unit test, assuming that failure is legit. |
The slider is debounced, so there need to delay and assert it. |
13c902a to
eeb1e45
Compare
|
🚀 |
|
@mrubens I found that there were still references to the ExtensionStateContext in the ModelPickers and those settings were not being snapshotted, working on fixing that. At the same time, I found a potential issue: due to the wrong type constraint, openAiCustomModelInfo was actually stored as openAiModelInfo |













Description
handleInputChangein ApiOptions.Type of change
How Has This Been Tested?
Checklist:
Additional context
Related Issues
Reviewers
Important
Fixes settings panel reset issue by decoupling
ApiOptionsfromExtensionStateContextand adding Save/Done buttons for explicit configuration changes.SettingsView.tsxto allow users to save or discard changes.ApiOptionsfromExtensionStateContext, allowing editing on a snapshot ofapiConfiguration.ApiOptions.tsxensure settings are only saved when Save is clicked.onApiConfigurationUpdateinSettingsView.tsxto handle API configuration updates.handleInputChangeinApiOptions.tsxto useonApiConfigurationUpdate.ApiOptions.test.tsxandSettingsView.test.tsxto reflect new Save/Done behavior.This description was created by
for a62e6a78fdd15b483f54befb7bcb6c20964b5389. It will automatically update as commits are pushed.