Skip to content

Commit

Permalink
using @observable.ref
Browse files Browse the repository at this point in the history
with the latest mobx version, this is allowed again
  • Loading branch information
lebalz committed Jul 29, 2024
1 parent f081867 commit 6ebe99b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/stores/SessionStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import iStore from './iStore';
const { NO_AUTH, TEST_USERNAME } = siteConfig.customFields as { TEST_USERNAME?: string; NO_AUTH?: boolean };

class State {
@observable accessor account: AccountInfo | undefined | null = undefined;
@observable.ref accessor account: AccountInfo | undefined | null = undefined;

@observable accessor _msalInstance: IPublicClientApplication | undefined = undefined;
@observable.ref accessor _msalInstance: IPublicClientApplication | undefined = undefined;

constructor() {}
}
Expand All @@ -19,7 +19,7 @@ export class SessionStore extends iStore {
readonly root: RootStore;
private static readonly NAME = 'SessionStore' as const;

@observable private accessor stateRef: State = new State();
@observable.ref private accessor stateRef: State = new State();

@observable accessor authMethod: 'apiKey' | 'msal';

Expand Down
4 changes: 2 additions & 2 deletions src/stores/SocketDataStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class SocketDataStore {
private readonly root: RootStore;
abortControllers = new Map<string, AbortController>();

@observable accessor socket: Socket<ServerToClientEvents, ClientToServerEvents>;
@observable.ref accessor socket: Socket<ServerToClientEvents, ClientToServerEvents>;

messages = observable<Message>([]);

Expand Down Expand Up @@ -83,7 +83,7 @@ export class SocketDataStore {
if (this.socket?.connected) {
this.socket.disconnect();
}
this.socket = undefined;
this.socket = io();
this.setLiveState(false);
}

Expand Down

0 comments on commit 6ebe99b

Please sign in to comment.