[WIKI-844] fix: realtime sync post vite migration with title editor sync and indexed db access (#8294)
* fix: robust way to handle socket connection and read from indexeddb cache when reqd * fix: realtime sync working with failure handling * fix: title editor added * merge preview into fix/realtime-sync * check * page renderer props * lint errors * lint errors * lint errors * sanitize html * sanitize html * format fix * fix lint
This commit is contained in:
parent
ff544c98b7
commit
e20f686398
32 changed files with 4060 additions and 1988 deletions
|
|
@ -13,6 +13,7 @@ import { PageEditorInstance } from "./page-editor-info";
|
|||
export type TBasePage = TPage & {
|
||||
// observables
|
||||
isSubmitting: TNameDescriptionLoader;
|
||||
isSyncingWithServer: "syncing" | "synced" | "error";
|
||||
// computed
|
||||
asJSON: TPage | undefined;
|
||||
isCurrentUserOwner: boolean;
|
||||
|
|
@ -35,6 +36,7 @@ export type TBasePage = TPage & {
|
|||
removePageFromFavorites: () => Promise<void>;
|
||||
duplicate: () => Promise<TPage | undefined>;
|
||||
mutateProperties: (data: Partial<TPage>, shouldUpdateName?: boolean) => void;
|
||||
setSyncingStatus: (status: "syncing" | "synced" | "error") => void;
|
||||
// sub-store
|
||||
editor: PageEditorInstance;
|
||||
};
|
||||
|
|
@ -73,6 +75,7 @@ export type TPageInstance = TBasePage &
|
|||
export class BasePage extends ExtendedBasePage implements TBasePage {
|
||||
// loaders
|
||||
isSubmitting: TNameDescriptionLoader = "saved";
|
||||
isSyncingWithServer: "syncing" | "synced" | "error" = "syncing";
|
||||
// page properties
|
||||
id: string | undefined;
|
||||
name: string | undefined;
|
||||
|
|
@ -155,6 +158,7 @@ export class BasePage extends ExtendedBasePage implements TBasePage {
|
|||
created_at: observable.ref,
|
||||
updated_at: observable.ref,
|
||||
deleted_at: observable.ref,
|
||||
isSyncingWithServer: observable.ref,
|
||||
// helpers
|
||||
oldName: observable.ref,
|
||||
setIsSubmitting: action,
|
||||
|
|
@ -535,4 +539,10 @@ export class BasePage extends ExtendedBasePage implements TBasePage {
|
|||
set(this, key, value);
|
||||
});
|
||||
};
|
||||
|
||||
setSyncingStatus = (status: "syncing" | "synced" | "error") => {
|
||||
runInAction(() => {
|
||||
this.isSyncingWithServer = status;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue