monkeytype/frontend
Christian Fehmer e838f71c78
fix: authentication issues when using multiple tabs (@fehmer) (#6790)
fixes #6279

- store the last use "remember login" state in localstorage
- initialize firebase auth with correct persistence (LOCAL if "remember
me" is set, SESSION otherwise)


initialization of `Auth` needs to by awaited. This required some
refactoring. During debugging it was useful to have easier control over
the `Auth` object.

Summary of the refactoring:

- don't expose firebase `App` or `Auth` (except for email-handler)
- initialise firebase in async method that can be awaited to ensure
setup is done before any call to firebase
- move `authStateChanged` handling from account-controller to our
firebase module which then calls `account-controller.readyFunction`.
- update all direct calls to `Auth` to use functions of our firebase
module
- move error handling and interpretation of `FirebaseError` to our
module and removed duplicate code
- use tryCatch helper on refactored code instead of native `try...
catch`

---------

Co-authored-by: Miodec <jack@monkeytype.com>
Co-authored-by: Lukas <dev@mardybum.de>
Co-authored-by: Seif Soliman <byseif21@gmail.com>
2025-08-11 13:11:51 +02:00
..
__tests__ test: remove duplicate config tests (@fehmer) (#6861) 2025-08-10 14:48:31 +02:00
docker chore: update nodejs to 20.19.4 (@fehmer) (#6805) 2025-07-30 10:06:04 +02:00
scripts refactor(schema): move font config to schema (@fehmer) (#6780) 2025-07-26 13:34:03 +02:00
src fix: authentication issues when using multiple tabs (@fehmer) (#6790) 2025-08-11 13:11:51 +02:00
static feat(layout): add Rulemak layout (@poli0iq) (#6835) 2025-08-05 14:22:00 +02:00
.eslintrc.cjs chore: add eslint compat plugin (@fehmer) (#6542) 2025-05-12 16:52:01 +02:00
.firebaserc_example
.oxlintrc.json chore(deps): upgrade oxlint to 1.8.0, fix errors (@camc314) (#6776) 2025-07-24 14:32:12 +02:00
firebase.json
gulpfile.js chore: add oxlint (@miodec) (#6455) 2025-04-16 17:18:50 +02:00
package.json fix: authentication issues when using multiple tabs (@fehmer) (#6790) 2025-08-11 13:11:51 +02:00
tsconfig.json
vite.config.dev.js refactor(schema): move font config to schema (@fehmer) (#6780) 2025-07-26 13:34:03 +02:00
vite.config.js refactor(schema): move font config to schema (@fehmer) (#6780) 2025-07-26 13:34:03 +02:00
vite.config.prod.js refactor(schema): move font config to schema (@fehmer) (#6780) 2025-07-26 13:34:03 +02:00
vitest.config.ts test: update to vitest3 (@fehmer) (#6811) 2025-08-04 15:55:10 +02:00