Skip to content
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: save secret key per form with useQuery to prevent need for entering secret key #5743

Merged
merged 1 commit into from
Feb 17, 2023

Conversation

darrelhong
Copy link
Contributor

@darrelhong darrelhong commented Feb 10, 2023

Problem

Users need to key in secret key each time they exit the form. PR also serves to achieve feature parity with angular

Closes #5514

Solution

use useQuery to store secretKey per form. Maintained signature of secretKey and setSecretKey in useSecretKeys.ts for minimal code change. queryFn resolves to string for type inference. Set stale time to infinity so that queryFn is never called again, resetting secretKey.

cc @amitogp @kennethchangOPENGOV

Breaking Changes

  • Yes - this PR contains breaking changes
    • Details ...
  • No - this PR is backwards compatible

Copy link
Contributor

@justynoh justynoh left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @darrelhong ! Just one small comment. Additionally, there's a linter warning - would you be able to fix it? thanks!

feature parity with angular
Copy link
Contributor

@justynoh justynoh left a comment

Choose a reason for hiding this comment

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

Great, lgtm - thanks for the contribution @darrelhong!

@justynoh
Copy link
Contributor

Closing and reopening to try and get tests to run

@justynoh justynoh closed this Feb 16, 2023
@justynoh justynoh reopened this Feb 16, 2023
@justynoh justynoh merged commit 606e656 into opengovsg:develop Feb 17, 2023
@wanlingt wanlingt mentioned this pull request Feb 23, 2023
32 tasks
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.

Users need to key in secret key each time they exit the form
2 participants