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
4924b238
Unverified
Commit
4924b238
authored
May 26, 2025
by
eya46
Committed by
GitHub
May 26, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: state mismatch in Storage and System pages (#4719)
* fix: sync storage setting state * fix: sync customProfile state
parent
64b27d5a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
StorageSection.tsx
web/src/components/Settings/StorageSection.tsx
+7
-1
WorkspaceSection.tsx
web/src/components/Settings/WorkspaceSection.tsx
+4
-3
No files found.
web/src/components/Settings/StorageSection.tsx
View file @
4924b238
...
@@ -2,7 +2,7 @@ import { Divider, List, ListItem, Radio, RadioGroup, Tooltip, Switch } from "@mu
...
@@ -2,7 +2,7 @@ import { Divider, List, ListItem, Radio, RadioGroup, Tooltip, Switch } from "@mu
import
{
Button
,
Input
}
from
"@usememos/mui"
;
import
{
Button
,
Input
}
from
"@usememos/mui"
;
import
{
isEqual
}
from
"lodash-es"
;
import
{
isEqual
}
from
"lodash-es"
;
import
{
HelpCircleIcon
}
from
"lucide-react"
;
import
{
HelpCircleIcon
}
from
"lucide-react"
;
import
React
,
{
useMemo
,
useState
}
from
"react"
;
import
React
,
{
use
Effect
,
use
Memo
,
useState
}
from
"react"
;
import
{
toast
}
from
"react-hot-toast"
;
import
{
toast
}
from
"react-hot-toast"
;
import
{
Link
}
from
"react-router-dom"
;
import
{
Link
}
from
"react-router-dom"
;
import
{
workspaceSettingNamePrefix
}
from
"@/store/v1"
;
import
{
workspaceSettingNamePrefix
}
from
"@/store/v1"
;
...
@@ -21,6 +21,12 @@ const StorageSection = () => {
...
@@ -21,6 +21,12 @@ const StorageSection = () => {
WorkspaceStorageSetting
.
fromPartial
(
workspaceStore
.
getWorkspaceSettingByKey
(
WorkspaceSettingKey
.
STORAGE
)?.
storageSetting
||
{}),
WorkspaceStorageSetting
.
fromPartial
(
workspaceStore
.
getWorkspaceSettingByKey
(
WorkspaceSettingKey
.
STORAGE
)?.
storageSetting
||
{}),
);
);
useEffect
(()
=>
{
setWorkspaceStorageSetting
(
WorkspaceStorageSetting
.
fromPartial
(
workspaceStore
.
getWorkspaceSettingByKey
(
WorkspaceSettingKey
.
STORAGE
)?.
storageSetting
||
{}),
);
},
[
workspaceStore
.
getWorkspaceSettingByKey
(
WorkspaceSettingKey
.
STORAGE
)]);
const
allowSaveStorageSetting
=
useMemo
(()
=>
{
const
allowSaveStorageSetting
=
useMemo
(()
=>
{
if
(
workspaceStorageSetting
.
uploadSizeLimitMb
<=
0
)
{
if
(
workspaceStorageSetting
.
uploadSizeLimitMb
<=
0
)
{
return
false
;
return
false
;
...
...
web/src/components/Settings/WorkspaceSection.tsx
View file @
4924b238
...
@@ -2,6 +2,7 @@ import { Select, Option, Divider, Switch } from "@mui/joy";
...
@@ -2,6 +2,7 @@ import { Select, Option, Divider, Switch } from "@mui/joy";
import
{
Button
,
Textarea
}
from
"@usememos/mui"
;
import
{
Button
,
Textarea
}
from
"@usememos/mui"
;
import
{
isEqual
}
from
"lodash-es"
;
import
{
isEqual
}
from
"lodash-es"
;
import
{
ExternalLinkIcon
}
from
"lucide-react"
;
import
{
ExternalLinkIcon
}
from
"lucide-react"
;
import
{
observer
}
from
"mobx-react-lite"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
toast
}
from
"react-hot-toast"
;
import
{
toast
}
from
"react-hot-toast"
;
import
{
Link
}
from
"react-router-dom"
;
import
{
Link
}
from
"react-router-dom"
;
...
@@ -14,7 +15,7 @@ import { WorkspaceGeneralSetting } from "@/types/proto/api/v1/workspace_setting_
...
@@ -14,7 +15,7 @@ import { WorkspaceGeneralSetting } from "@/types/proto/api/v1/workspace_setting_
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
showUpdateCustomizedProfileDialog
from
"../UpdateCustomizedProfileDialog"
;
import
showUpdateCustomizedProfileDialog
from
"../UpdateCustomizedProfileDialog"
;
const
WorkspaceSection
=
()
=>
{
const
WorkspaceSection
=
observer
(
()
=>
{
const
t
=
useTranslate
();
const
t
=
useTranslate
();
const
originalSetting
=
WorkspaceGeneralSetting
.
fromPartial
(
const
originalSetting
=
WorkspaceGeneralSetting
.
fromPartial
(
workspaceStore
.
getWorkspaceSettingByKey
(
WorkspaceSettingKey
.
GENERAL
)?.
generalSetting
||
{},
workspaceStore
.
getWorkspaceSettingByKey
(
WorkspaceSettingKey
.
GENERAL
)?.
generalSetting
||
{},
...
@@ -23,7 +24,7 @@ const WorkspaceSection = () => {
...
@@ -23,7 +24,7 @@ const WorkspaceSection = () => {
const
[
identityProviderList
,
setIdentityProviderList
]
=
useState
<
IdentityProvider
[]
>
([]);
const
[
identityProviderList
,
setIdentityProviderList
]
=
useState
<
IdentityProvider
[]
>
([]);
useEffect
(()
=>
{
useEffect
(()
=>
{
setWorkspaceGeneralSetting
(
originalSetting
);
setWorkspaceGeneralSetting
(
{
...
workspaceGeneralSetting
,
customProfile
:
originalSetting
.
customProfile
}
);
},
[
workspaceStore
.
getWorkspaceSettingByKey
(
WorkspaceSettingKey
.
GENERAL
)]);
},
[
workspaceStore
.
getWorkspaceSettingByKey
(
WorkspaceSettingKey
.
GENERAL
)]);
const
handleUpdateCustomizedProfileButtonClick
=
()
=>
{
const
handleUpdateCustomizedProfileButtonClick
=
()
=>
{
...
@@ -162,6 +163,6 @@ const WorkspaceSection = () => {
...
@@ -162,6 +163,6 @@ const WorkspaceSection = () => {
</
div
>
</
div
>
</
div
>
</
div
>
);
);
};
}
)
;
export
default
WorkspaceSection
;
export
default
WorkspaceSection
;
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