-
Notifications
You must be signed in to change notification settings - Fork 45
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
Enhancement - only save keys to settings.providers if validated #597
Conversation
Deploying chatcraft-org with
|
Latest commit: |
a88885c
|
Status: | ✅ Deploy successful! |
Preview URL: | https://0bd70c1a.console-overthinker-dev.pages.dev |
Branch Preview URL: | https://issue-596.console-overthinker-dev.pages.dev |
@rjwignar @Rachit1313 Sorry not yet ready for review. Will comment again when it is. |
@rjwignar @Rachit1313 Now it is ready for review |
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.
Looks good to me.
I think Error was more correct here..as it's fairly fatal that you can't validate your key |
@tarasglek Ok, I modified the code so that users trying to add a new custom provider but gave an invalid url or invalid key will get the "error" type alert instead of the warning |
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.
It looks good to me.
Fixes #596
Summary: No longer saving providers or their api keys to
settings.providers
array unless the api key is validated. If an invalid or blank is entered, the provider is REMOVED fromsettings.providers
.Important coding points:
useDebounce
code, it wasn't working and is not worth the trouble to fix.useDebounce
is sort of like auseEffect
, but which allows us to wait until the user stops typing to validate the key. However, we do not expect anyone to be typing out a 32 character api key anyways, so opted to remove.tableProviders
and only when they are validated they are stored tosettings.providers
tableProviders
is synced withsettings.providers
: (when "syncing" happens, those invalid and blank api keys will disappear)