diff --git a/web/src/store/attachment.ts b/web/src/store/attachment.ts index 09ab9a223..d5c2d82a6 100644 --- a/web/src/store/attachment.ts +++ b/web/src/store/attachment.ts @@ -4,6 +4,7 @@ * Manages file attachment state including uploads and metadata. * This is a server state store that fetches and caches attachment data. */ +import { makeObservable, observable, computed } from "mobx"; import { attachmentServiceClient } from "@/grpcweb"; import { CreateAttachmentRequest, Attachment, UpdateAttachmentRequest } from "@/types/proto/api/v1/attachment_service"; import { StandardState, createServerStore } from "./base-store"; @@ -19,6 +20,15 @@ class AttachmentState extends StandardState { */ attachmentMapByName: Record = {}; + constructor() { + super(); + makeObservable(this, { + attachmentMapByName: observable, + attachments: computed, + size: computed, + }); + } + /** * Computed getter for all attachments as an array */ diff --git a/web/src/store/base-store.ts b/web/src/store/base-store.ts index 0e27b2abe..d0e9f2bb6 100644 --- a/web/src/store/base-store.ts +++ b/web/src/store/base-store.ts @@ -6,7 +6,7 @@ * - BaseClientStore: For stores that manage UI/client state * - Common patterns for all stores */ -import { makeAutoObservable } from "mobx"; +import { makeObservable, action } from "mobx"; import { RequestDeduplicator, StoreError } from "./store-utils"; /** @@ -166,7 +166,9 @@ export function createClientStore(state: TState, confi */ export abstract class StandardState implements BaseState { constructor() { - makeAutoObservable(this); + makeObservable(this, { + setPartial: action, + }); } setPartial(partial: Partial): void {