fix: Unable to access document without reload after 24h+ session
This commit is contained in:
@@ -94,13 +94,10 @@ function MultiplayerEditor({ onSynced, ...props }: Props, ref: any) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
provider.on("authenticationFailed", () => {
|
provider.on("authenticationFailed", () => {
|
||||||
showToast(
|
void auth.fetch().catch(() => {
|
||||||
t(
|
|
||||||
"Sorry, it looks like you don’t have permission to access the document"
|
|
||||||
)
|
|
||||||
);
|
|
||||||
history.replace(homePath());
|
history.replace(homePath());
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
provider.on("awarenessChange", (event: AwarenessChangeEvent) => {
|
provider.on("awarenessChange", (event: AwarenessChangeEvent) => {
|
||||||
presence.updateFromAwarenessChangeEvent(documentId, event);
|
presence.updateFromAwarenessChangeEvent(documentId, event);
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import { getCookie, setCookie, removeCookie } from "tiny-cookie";
|
|||||||
import { CustomTheme, TeamPreferences, UserPreferences } from "@shared/types";
|
import { CustomTheme, TeamPreferences, UserPreferences } from "@shared/types";
|
||||||
import Storage from "@shared/utils/Storage";
|
import Storage from "@shared/utils/Storage";
|
||||||
import { getCookieDomain, parseDomain } from "@shared/utils/domains";
|
import { getCookieDomain, parseDomain } from "@shared/utils/domains";
|
||||||
import { Hour } from "@shared/utils/time";
|
|
||||||
import RootStore from "~/stores/RootStore";
|
import RootStore from "~/stores/RootStore";
|
||||||
import Policy from "~/models/Policy";
|
import Policy from "~/models/Policy";
|
||||||
import Team from "~/models/Team";
|
import Team from "~/models/Team";
|
||||||
@@ -106,9 +105,6 @@ export default class AuthStore {
|
|||||||
this.rehydrate(data);
|
this.rehydrate(data);
|
||||||
void this.fetch();
|
void this.fetch();
|
||||||
|
|
||||||
// Refresh the auth store every 12 hours that the window is open
|
|
||||||
setInterval(this.fetch, 12 * Hour);
|
|
||||||
|
|
||||||
// persists this entire store to localstorage whenever any keys are changed
|
// persists this entire store to localstorage whenever any keys are changed
|
||||||
autorun(() => {
|
autorun(() => {
|
||||||
Storage.set(AUTH_STORE, this.asJson);
|
Storage.set(AUTH_STORE, this.asJson);
|
||||||
@@ -238,7 +234,10 @@ export default class AuthStore {
|
|||||||
if (err.error === "user_suspended") {
|
if (err.error === "user_suspended") {
|
||||||
this.isSuspended = true;
|
this.isSuspended = true;
|
||||||
this.suspendedContactEmail = err.data.adminEmail;
|
this.suspendedContactEmail = err.data.adminEmail;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw err;
|
||||||
} finally {
|
} finally {
|
||||||
this.isFetching = false;
|
this.isFetching = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -523,7 +523,6 @@
|
|||||||
"Viewed {{ count }} times by {{ teamMembers }} people_plural": "Viewed {{ count }} times by {{ teamMembers }} people",
|
"Viewed {{ count }} times by {{ teamMembers }} people_plural": "Viewed {{ count }} times by {{ teamMembers }} people",
|
||||||
"Viewer insights": "Viewer insights",
|
"Viewer insights": "Viewer insights",
|
||||||
"As an admin you can manage if team members can see who has viewed this document": "As an admin you can manage if team members can see who has viewed this document",
|
"As an admin you can manage if team members can see who has viewed this document": "As an admin you can manage if team members can see who has viewed this document",
|
||||||
"Sorry, it looks like you don’t have permission to access the document": "Sorry, it looks like you don’t have permission to access the document",
|
|
||||||
"Sorry, this document is too large - edits will no longer be persisted.": "Sorry, this document is too large - edits will no longer be persisted.",
|
"Sorry, this document is too large - edits will no longer be persisted.": "Sorry, this document is too large - edits will no longer be persisted.",
|
||||||
"Sorry, the last change could not be persisted – please reload the page": "Sorry, the last change could not be persisted – please reload the page",
|
"Sorry, the last change could not be persisted – please reload the page": "Sorry, the last change could not be persisted – please reload the page",
|
||||||
"This template will be permanently deleted in <2></2> unless restored.": "This template will be permanently deleted in <2></2> unless restored.",
|
"This template will be permanently deleted in <2></2> unless restored.": "This template will be permanently deleted in <2></2> unless restored.",
|
||||||
|
|||||||
Reference in New Issue
Block a user