Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
686d31b3
Commit
686d31b3
authored
Oct 23, 2025
by
Claude
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: enhance attachment store with MobX observables and actions
parent
e35f1630
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
attachment.ts
web/src/store/attachment.ts
+10
-0
base-store.ts
web/src/store/base-store.ts
+4
-2
No files found.
web/src/store/attachment.ts
View file @
686d31b3
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
* Manages file attachment state including uploads and metadata.
* Manages file attachment state including uploads and metadata.
* This is a server state store that fetches and caches attachment data.
* This is a server state store that fetches and caches attachment data.
*/
*/
import
{
makeObservable
,
observable
,
computed
}
from
"mobx"
;
import
{
attachmentServiceClient
}
from
"@/grpcweb"
;
import
{
attachmentServiceClient
}
from
"@/grpcweb"
;
import
{
CreateAttachmentRequest
,
Attachment
,
UpdateAttachmentRequest
}
from
"@/types/proto/api/v1/attachment_service"
;
import
{
CreateAttachmentRequest
,
Attachment
,
UpdateAttachmentRequest
}
from
"@/types/proto/api/v1/attachment_service"
;
import
{
StandardState
,
createServerStore
}
from
"./base-store"
;
import
{
StandardState
,
createServerStore
}
from
"./base-store"
;
...
@@ -19,6 +20,15 @@ class AttachmentState extends StandardState {
...
@@ -19,6 +20,15 @@ class AttachmentState extends StandardState {
*/
*/
attachmentMapByName
:
Record
<
string
,
Attachment
>
=
{};
attachmentMapByName
:
Record
<
string
,
Attachment
>
=
{};
constructor
()
{
super
();
makeObservable
(
this
,
{
attachmentMapByName
:
observable
,
attachments
:
computed
,
size
:
computed
,
});
}
/**
/**
* Computed getter for all attachments as an array
* Computed getter for all attachments as an array
*/
*/
...
...
web/src/store/base-store.ts
View file @
686d31b3
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* - BaseClientStore: For stores that manage UI/client state
* - BaseClientStore: For stores that manage UI/client state
* - Common patterns for all stores
* - Common patterns for all stores
*/
*/
import
{
make
AutoObservable
}
from
"mobx"
;
import
{
make
Observable
,
action
}
from
"mobx"
;
import
{
RequestDeduplicator
,
StoreError
}
from
"./store-utils"
;
import
{
RequestDeduplicator
,
StoreError
}
from
"./store-utils"
;
/**
/**
...
@@ -166,7 +166,9 @@ export function createClientStore<TState extends BaseState>(state: TState, confi
...
@@ -166,7 +166,9 @@ export function createClientStore<TState extends BaseState>(state: TState, confi
*/
*/
export
abstract
class
StandardState
implements
BaseState
{
export
abstract
class
StandardState
implements
BaseState
{
constructor
()
{
constructor
()
{
makeAutoObservable
(
this
);
makeObservable
(
this
,
{
setPartial
:
action
,
});
}
}
setPartial
(
partial
:
Partial
<
this
>
):
void
{
setPartial
(
partial
:
Partial
<
this
>
):
void
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment