Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
feat: enhance attachment store with MobX observables and actions
Claude686d31b357f3
diff --git a/web/src/store/attachment.ts b/web/src/store/attachment.tsindex 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<string, Attachment> = {};+ 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.tsindex 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<TState extends BaseState>(state: TState, confi*/export abstract class StandardState implements BaseState {constructor() {- makeAutoObservable(this);+ makeObservable(this, {+ setPartial: action,+ });}setPartial(partial: Partial<this>): void {