diff options
author | bobzel <zzzman@gmail.com> | 2023-12-10 20:19:27 -0500 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2023-12-10 20:19:27 -0500 |
commit | 380ee1acac1c0b7972d7d423cf804af146dc0edf (patch) | |
tree | 1d77244a600e6eb1fb6d56356b3ce01ca6add89d /src/fields/Doc.ts | |
parent | b7b7105fac83ec11480204c5c7ac0ae6579774e1 (diff) |
massive changes to use mobx 6 which means not accessing props directly in @computed functions.
Diffstat (limited to 'src/fields/Doc.ts')
-rw-r--r-- | src/fields/Doc.ts | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index 6fb97d70c..5449c8dea 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -1,5 +1,5 @@ import { saveAs } from 'file-saver'; -import { action, computed, observable, ObservableMap, ObservableSet, runInAction } from 'mobx'; +import { action, computed, makeObservable, observable, ObservableMap, ObservableSet, runInAction } from 'mobx'; import { computedFn } from 'mobx-utils'; import { alias, map, serializable } from 'serializr'; import { DocServer } from '../client/DocServer'; @@ -131,9 +131,9 @@ export function updateCachedAcls(doc: Doc) { @Deserializable('Doc', updateCachedAcls, ['id']) export class Doc extends RefField { @observable public static RecordingEvent = 0; - @observable public static GuestDashboard: Doc | undefined; - @observable public static GuestTarget: Doc | undefined; - @observable public static GuestMobile: Doc | undefined; + @observable public static GuestDashboard: Doc | undefined = undefined; + @observable public static GuestTarget: Doc | undefined = undefined; + @observable public static GuestMobile: Doc | undefined = undefined; public static CurrentUserEmail: string = ''; public static get MySharedDocs() { return DocCast(Doc.UserDoc().mySharedDocs); } // prettier-ignore @@ -178,6 +178,7 @@ export class Doc extends RefField { constructor(id?: FieldId, forceSave?: boolean) { super(id); + makeObservable(this); const docProxy = new Proxy<this>(this, { set: setter, get: getter, @@ -185,7 +186,36 @@ export class Doc extends RefField { has: (target, key) => GetEffectiveAcl(target) !== AclPrivate && key in target.__fieldTuples, ownKeys: target => { const keys = GetEffectiveAcl(target) !== AclPrivate ? Object.keys(target[FieldKeys]) : []; - return [...keys, '__LAYOUT__']; + return [ + ...keys, + AclAdmin, + AclAugment, + AclEdit, + AclPrivate, + AclReadonly, + Animation, + AudioPlay, + Brushed, + CachedUpdates, + DirectLinks, + DocAcl, + DocCss, + DocData, + DocFields, + DocLayout, + DocViews, + FieldKeys, + FieldTuples, + ForceServerWrite, + Height, + Highlight, + Initializing, + Self, + SelfProxy, + UpdatingFromServer, + Width, + '__LAYOUT__', + ]; }, getOwnPropertyDescriptor: (target, prop) => { if (prop.toString() === '__LAYOUT__' || !(prop in target[FieldKeys])) { |