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

refactor(experience): cache user input identifier for a better sign-in experience #6164

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

xiaoyijun
Copy link
Contributor

@xiaoyijun xiaoyijun commented Jul 2, 2024

Summary

This PR introduces a significant refactoring of the user input identifier caching mechanism to enhance the sign-in experience. The main changes include:

  • Implementation of a new UserInteractionContext to manage and persist user input identifiers across different pages and flows.
  • Introduction of session storage for caching identifier input values, improving user experience when navigating between pages.
  • Refactoring of various components and hooks to utilize the new context and storage mechanism, including:
    • ForgotPassword flow
    • SignIn flow
    • Registration flow
    • Password reset flow
  • Removal of state passing through react-router, replacing it with the new context-based approach.
  • Updates to relevant test cases to accommodate the new caching mechanism.

These changes aim to provide a more seamless and consistent experience for users across different authentication flows, reducing the need for re-entering information and improving overall usability.

The refactoring touches multiple files across the experience package, primarily focusing on state management and data persistence between different steps of the authentication process.

Testing

Test locally and all IT passed.

Checklist

  • .changeset
  • unit tests
  • integration tests
  • necessary TSDoc comments

@xiaoyijun xiaoyijun requested a review from a team July 2, 2024 09:04
@xiaoyijun xiaoyijun self-assigned this Jul 2, 2024
@github-actions github-actions bot added the enhancement Make it better label Jul 2, 2024
Copy link

github-actions bot commented Jul 2, 2024

COMPARE TO master

Total Size Diff 📈 +8.35 KB

Diff by File
Name Diff
packages/experience/src/Providers/UserInteractionContextProvider/UserInteractionContext.tsx 📈 +1.61 KB
packages/experience/src/Providers/UserInteractionContextProvider/index.tsx 📈 +1.46 KB
packages/experience/src/components/InputFields/SmartInputField/use-smart-input-field.ts 📈 +233 Bytes
packages/experience/src/containers/ForgotPasswordLink/index.tsx 📈 +474 Bytes
packages/experience/src/containers/VerificationCode/PasswordSignInLink.tsx 📈 +220 Bytes
packages/experience/src/containers/VerificationCode/index.tsx 📈 +36 Bytes
packages/experience/src/hooks/use-check-single-sign-on.ts 0 Bytes
packages/experience/src/hooks/use-global-redirect-to.ts 📈 +510 Bytes
packages/experience/src/hooks/use-send-verification-code.ts 📈 +37 Bytes
packages/experience/src/hooks/use-session-storages.ts 📈 +303 Bytes
packages/experience/src/pages/Continue/SetEmailOrPhone/index.tsx 📈 +273 Bytes
packages/experience/src/pages/Continue/SetUsername/index.tsx 📈 +274 Bytes
packages/experience/src/pages/ForgotPassword/ForgotPasswordForm/index.test.tsx 📈 +148 Bytes
packages/experience/src/pages/ForgotPassword/ForgotPasswordForm/index.tsx 📈 +379 Bytes
packages/experience/src/pages/ForgotPassword/index.test.tsx 📈 +541 Bytes
packages/experience/src/pages/ForgotPassword/index.tsx 📈 +4 Bytes
packages/experience/src/pages/Register/IdentifierRegisterForm/index.test.tsx 📈 +580 Bytes
packages/experience/src/pages/Register/IdentifierRegisterForm/index.tsx 📈 +403 Bytes
packages/experience/src/pages/ResetPassword/index.tsx 📈 +363 Bytes
packages/experience/src/pages/SignIn/IdentifierSignInForm/index.test.tsx 📈 +722 Bytes
packages/experience/src/pages/SignIn/IdentifierSignInForm/index.tsx 📈 +402 Bytes
packages/experience/src/pages/SignIn/IdentifierSignInForm/use-on-submit.ts 📈 +139 Bytes
packages/experience/src/pages/SignIn/PasswordSignInForm/index.tsx 📈 +272 Bytes
packages/experience/src/pages/SignInPassword/PasswordForm/index.test.tsx 📈 +42 Bytes
packages/experience/src/pages/SignInPassword/PasswordForm/index.tsx 📈 +266 Bytes
packages/experience/src/pages/SignInPassword/index.test.tsx 📈 +320 Bytes
packages/experience/src/pages/SignInPassword/index.tsx 📈 +26 Bytes
packages/experience/src/pages/VerificationCode/index.test.tsx 📈 +516 Bytes
packages/experience/src/pages/VerificationCode/index.tsx 📈 +29 Bytes
packages/experience/src/types/guard.ts 📈 +69 Bytes

@github-actions github-actions bot added the size/m label Jul 2, 2024
@wangsijie
Copy link
Contributor

CI failed

@xiaoyijun xiaoyijun force-pushed the xiaoyijun-log-4958-cache-input-value-so-it-can-be-retrieved-when-click-on-back branch from 74da055 to 5dc2e45 Compare July 3, 2024 06:27
@github-actions github-actions bot added size/l and removed size/m labels Jul 3, 2024
@xiaoyijun xiaoyijun force-pushed the xiaoyijun-log-4958-cache-input-value-so-it-can-be-retrieved-when-click-on-back branch 2 times, most recently from 184e22c to 2e56683 Compare July 3, 2024 06:57
@github-actions github-actions bot added size/m and removed size/l labels Jul 3, 2024
@xiaoyijun xiaoyijun changed the title refactor(experience): cache user inputidentifer for a better sign-in experience refactor(experience): cache user input identifier for a better sign-in experience Jul 3, 2024
@xiaoyijun xiaoyijun force-pushed the xiaoyijun-log-4958-cache-input-value-so-it-can-be-retrieved-when-click-on-back branch 2 times, most recently from cb63d08 to bdaea40 Compare July 3, 2024 07:28
@github-actions github-actions bot added size/l and removed size/m labels Jul 3, 2024
Base automatically changed from xiaoyijun-log-9515-refactor-ssocontextprovider to master July 4, 2024 02:52
@github-actions github-actions bot added size/xl and removed size/l labels Jul 4, 2024
@xiaoyijun xiaoyijun force-pushed the xiaoyijun-log-4958-cache-input-value-so-it-can-be-retrieved-when-click-on-back branch from bdaea40 to 405183f Compare July 4, 2024 04:08
@github-actions github-actions bot added size/l and removed size/xl labels Jul 4, 2024
@xiaoyijun xiaoyijun force-pushed the xiaoyijun-log-4958-cache-input-value-so-it-can-be-retrieved-when-click-on-back branch from 405183f to a4de3a2 Compare July 4, 2024 09:51
@github-actions github-actions bot added size/xl and removed size/l labels Jul 4, 2024
@xiaoyijun xiaoyijun force-pushed the xiaoyijun-log-4958-cache-input-value-so-it-can-be-retrieved-when-click-on-back branch from 0bb2f11 to 6f7f4e2 Compare July 4, 2024 10:05
@xiaoyijun xiaoyijun force-pushed the xiaoyijun-log-4958-cache-input-value-so-it-can-be-retrieved-when-click-on-back branch from 6f7f4e2 to 9dece09 Compare July 5, 2024 00:34
@xiaoyijun xiaoyijun force-pushed the xiaoyijun-log-4958-cache-input-value-so-it-can-be-retrieved-when-click-on-back branch from 9dece09 to b97b3be Compare July 5, 2024 01:19
Copy link
Contributor

@simeng-li simeng-li left a comment

Choose a reason for hiding this comment

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

overall LGTM

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

Successfully merging this pull request may close these issues.

None yet

3 participants