Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

router.reload is an undocumented, semi-deprecated, oneliner

Manav Rathid8650aa33dfc
diff --git a/web/apps/photos/src/components/Sidebar/Preferences.tsx b/web/apps/photos/src/components/Sidebar/Preferences.tsx
index 4090d49194..301dd13058 100644
--- a/web/apps/photos/src/components/Sidebar/Preferences.tsx
+++ b/web/apps/photos/src/components/Sidebar/Preferences.tsx
@@ -91,7 +91,7 @@ const LanguageSelector = () => {
const updateCurrentLocale = (newLocale: SupportedLocale) => {
setLocaleInUse(newLocale);
- router.reload();
+ window.location.reload();
};
const options = supportedLocales.map((locale) => ({
diff --git a/web/packages/accounts/pages/credentials.tsx b/web/packages/accounts/pages/credentials.tsx
index 284b2c2ee3..9d0e1cad61 100644
--- a/web/packages/accounts/pages/credentials.tsx
+++ b/web/packages/accounts/pages/credentials.tsx
@@ -97,7 +97,7 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
// This should be a rare occurence, instead of building
// the scaffolding to update all the in-memory state,
// just reload everything.
- router.reload();
+ window.location.reload();
}
}
} catch (e) {
diff --git a/web/packages/accounts/services/session.ts b/web/packages/accounts/services/session.ts
index e4e3aa658d..2d6ae15d92 100644
--- a/web/packages/accounts/services/session.ts
+++ b/web/packages/accounts/services/session.ts
@@ -30,8 +30,13 @@ type SessionValidity =
* to the 99% user experience (of normal unlocks) for the 1% case (they've
* changed their password elsewhere).
*
- * The approach we instead use is to make an non-blocking /session-validity API
- * call when this page is loaded. This API call tells us:
+ * The approach we instead use is to make an non-blocking `/session-validity`
+ * API call when this page is loaded. Usually this'll complete well before the
+ * password enters their password and presses "Sign in", but we also
+ * transparently await for this API call to finish before initiating the actual
+ * verification. Thus there is no extra latency in the happy paths.
+ *
+ * The `/session-validity` API call tells us:
*
* 1. Whether or not the session has been invalidated (by the user choosing to
* log out from all devices elsewhere).