-
Notifications
You must be signed in to change notification settings - Fork 14
Pressing "save" on an empty custom API key text field accidentally shows the "updated successfully" snackbar #264
Comments
Technically, the behavior is not incorrect:
As you can see in the lines above, if the content of the text field is empty, then the API key is set to the default one. Perhaps we can show a different snack bar text in that case, something like "API key set to default successfully." |
That doesn't make any sense to me. We shouldn't show anything if the user pressed "save" on a blank text field. |
That's assuming that nothing happened, but in this case, the API key WAS updated, just to the default one. |
Well, technically, yes, but it will be weird to show the user a snackbar when leaving the text field empty. |
Well, any alternatives then? The API key was updated, it wouldn't be wise not to tell the user that it was. |
Just ... don't show a snackbar when the text field is left empty. If the user wants to get back to using the default API key, there is a button dedicated for that. |
That doesn't change the fact that the API key will be set to the default one without the user knowing it. My proposal: move the "reset API key" thing into the dialog as a "Reset" action button or something like that, and don't allow the user to save the API key unless the text field is not empty. That solves the issue. |
I'm still not convinced by your claim though, because if there was an API key and it was removed manually by the user, then isn't that a change the user should be alerted about? |
To the user, it makes zero sense. |
We shouldn't allow the text field to save if it's blank |
That's the simplest solution to the problem |
We can have a setting where a user can choose whether they want to use the default API key or a custom one, and only allow them to provide a custom API key when the setting is set to custom. |
That way they will never get the dialog if they're using the default API key. |
@prestosole sounds good, feel free to open an issue for that. |
Describe the bug
Pressing "save" on an empty custom API key text field accidentally shows the "updated successfully" snackbar
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The "API key updated successfully" snackbar should only be shown when a user enters a real API key and not any text, including leaving the text field blank.
Smartphone (please complete the following information):
The text was updated successfully, but these errors were encountered: