-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
"Regenerate Key" button creates a duplicate API key #3956
Comments
Thanks for the report! I can reproduce it |
Hi @Abuhafsa & @FelixMalfait. I am very new to open source and was looking at this issue to contribute. I noticed that the duplicates 'go away' after a refresh of the webpage. |
Thanks @sohalkumar The old key isn't really removed from the database, we just add a date on the "revokedAt" column. Probably this is done correctly on the database side but isn't properly reflected on the Apollo cache. So when we go back to the page that lists API Keys, Apollo doesn't call the server again. Probably you can use |
This could also explain the reason that keys are not 'removed' from the table after we delete(disable) them. They are also only removed after a refresh.
I will try my best to look into it and possibly come up to a solution. |
@FelixMalfait @sohalkumar We don't have to use refetch query. It should be handled by the optimistic cache logic. In the idea, the initial graphql query should be filtering on revokedAt: null We might have a bug there! |
I looked at the
Both of these have the exact same logic which leads to the 'regenerated key' being added due to the logic in What I propose is changing the
If I am going in the right direction please assign this issue to me. |
@sohalkumar I believe this has been fixed recently actually. Could you see if the issue still happens on main branch? |
Yes the issue is fixed and there is no duplicates anymore but the modal(pop up) that asks for the confirmatioin does not go away even after typing yes and clicking on re generate. If I click out of it the regenetated key is not visible. |
oh good catch @sohalkumar can you try fixing that one then :)) ? Thanks! |
adding this in the end of the |
Would be best to manage this in |
What I could think of is adding the following in the onClick of "Regenerate Key" button inside
This works but there must, obviously, be a better approach but I can't seem to figure it out as of now :') |
@sohalkumar The approach you describe seems to work! :) what's wrong with it? |
Hello @charlesBochet I just thought there might be a better approach to solve this ^_^" |
Yes, please go ahead, looks to be a good solution! |
Hi @charlesBochet I just raised a PR. Please review it. |
PR has been merged, thank you! Closing this issue |
@charlesBochet |
Bug Description
When creating an API key on the UI, and then clicking the "Regenerate Key" button, I notice a new key is created under Settings > Developers.
Expected behavior
When clicking on "Regenerate Key" button, I do not want a duplication of the key but rather overwrite the same key.
The text was updated successfully, but these errors were encountered: