Skip to content

Fix wrong model after login (#213) #354

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hassoncs
Copy link

@hassoncs hassoncs commented May 7, 2025

Previously we were spreading the entire prevCachedState.apiConfiguration object when the keys changed, which would wipe out unsaved changes the user might have made to things like prevCachedState.apiConfiguration.kiloModel. Now we only set the keys that might be set via callback and don't trigger a save explicitly. The user will need to click 'save' in order to exit the SettingView like normal (same as changing any other setting).

213-fix-wrong-model-after-login

  • update state with specific tokens/keys to avoid overwriting unsaved changes
  • simplify useEffect dependencies by using direct variables

Dev thoughts
This does make me think.. should "login" keys / tokens be a "setting"? seems like it should be in the Settings view UI, but possibly separate from the other settings state of the api. I feel like it's not intuitive to have to click a "save" button once you login to something for it to remain saved.

Test plan: Verified that logging in / out no longer overwrites other non-saved changes in the Settings. Now users will have to click save for any changes they make, including login state. (This should be ok since we have that confirmation dialog if they don't.)

Copy link

changeset-bot bot commented May 7, 2025

🦋 Changeset detected

Latest commit: 990ece9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
kilo-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@hassoncs hassoncs force-pushed the fix-wrong-model-after-login-213 branch from 4d22dac to 8be91f3 Compare May 7, 2025 23:57
@hassoncs hassoncs marked this pull request as ready for review May 7, 2025 23:57
@hassoncs hassoncs changed the title Fix wrong model after login [#213] Fix wrong model after login (#213) May 7, 2025
Previously we were spreading the entire `prevCachedState.apiConfiguration` object when the keys changed, which would wipe out unsaved changes the user might have made to things like `prevCachedState.apiConfiguration.kiloModel`. Now we only set the keys that might be set via callback and don't trigger a save explicitly. The user will need to click 'save' in order to exit the SettingView like normal (same as changing any other setting).

- update state with specific tokens/keys to avoid overwriting unsaved changes
- simplify useEffect dependencies by using direct variables

**Dev thoughts**
This does make me think.. should "login" keys / tokens be a "setting"? seems like it should be in the Settings view UI, but possibly separate from the other settings state of the api. I feel like it's not intuitive to have to click a "save" button once you login to something for it to remain saved.

**Test plan**: Verified that logging in / out no longer overwrites other non-saved changes in the Settings. Now users will have to click save for any changes they make, including login state. (This should be ok since we have that confirmation dialog if they don't.)

**Closes** #123
@hassoncs hassoncs force-pushed the fix-wrong-model-after-login-213 branch from 8be91f3 to 990ece9 Compare May 8, 2025 00:04
Copy link
Collaborator

@drakonen drakonen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, unsure about the .changeset file if that should be included,

@kevinvandijk should this PR have a .changeset file?

Copy link
Collaborator

@kevinvandijk kevinvandijk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This introduces a regression of a previous bug. Now when changing a setting and then clicking on 'Done', then clicking on 'Discard changes'. It will freeze. See screen shot
image

@kevinvandijk
Copy link
Collaborator

This does make me think.. should "login" keys / tokens be a "setting"? seems like it should be in the Settings view UI, but possibly separate from the other settings state of the api.

I agree. This is a bit of a weird flow but we accepted it for now because usually people will only log in on the welcome flow and logging out here and logging back in is not a common use case. Once we start on customizing it to be our own settingsview we should work on improving that. Eventually we like to add token support as well in #240 but this also requires backend changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants