OAuthCallback.tsx traded the sign-in code every time its effect ran:
twice under StrictMode, again whenever its dependencies changed (the
translations loading), and again on a reload of the callback page. The
server refuses a spent code, so a sign-in that had worked could end on
an error.
New src/services/auth/codeOnce.ts:
a second run for the same code leaves it to the trade under way;
a code that brought tokens is remembered for the tab (sessionStorage),
so a reload goes on to the console when signed in, or to a fresh
sign-in when not, instead of showing an error;
a failed trade isn't remembered.
Tests cover each case, including a reload (fresh module, same storage).
Typecheck, lint, i18n:check, all 673 tests, build and notice check pass
locally. No new strings.
`OAuthCallback.tsx` traded the sign-in code every time its effect ran:
twice under StrictMode, again whenever its dependencies changed (the
translations loading), and again on a reload of the callback page. The
server refuses a spent code, so a sign-in that had worked could end on
an error.
New `src/services/auth/codeOnce.ts`:
- a second run for the same code leaves it to the trade under way;
- a code that brought tokens is remembered for the tab (sessionStorage),
so a reload goes on to the console when signed in, or to a fresh
sign-in when not, instead of showing an error;
- a failed trade isn't remembered.
Tests cover each case, including a reload (fresh module, same storage).
Typecheck, lint, i18n:check, all 673 tests, build and notice check pass
locally. No new strings.
The callback page traded the code every time its effect ran: twice under
StrictMode, again when the translations loaded, and again on a reload of
the page. The server refuses a spent code, so a sign-in that had worked
could end on an error.
A code is now traded once. A second run leaves it to the trade under
way, and a code already traded (kept for the tab in sessionStorage) goes
on to the console when signed in, or to a fresh sign-in when not.
No new strings.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
OAuthCallback.tsxtraded the sign-in code every time its effect ran:twice under StrictMode, again whenever its dependencies changed (the
translations loading), and again on a reload of the callback page. The
server refuses a spent code, so a sign-in that had worked could end on
an error.
New
src/services/auth/codeOnce.ts:so a reload goes on to the console when signed in, or to a fresh
sign-in when not, instead of showing an error;
Tests cover each case, including a reload (fresh module, same storage).
Typecheck, lint, i18n:check, all 673 tests, build and notice check pass
locally. No new strings.