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
89a270ce
Commit
89a270ce
authored
Feb 27, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: add username to cache key
parent
55263556
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
index.tsx
web/src/components/MemoEditor/index.tsx
+4
-2
No files found.
web/src/components/MemoEditor/index.tsx
View file @
89a270ce
...
...
@@ -6,6 +6,7 @@ import useLocalStorage from "react-use/lib/useLocalStorage";
import
{
memoServiceClient
}
from
"@/grpcweb"
;
import
{
TAB_SPACE_WIDTH
,
UNKNOWN_ID
}
from
"@/helpers/consts"
;
import
{
isValidUrl
}
from
"@/helpers/utils"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
{
useGlobalStore
,
useResourceStore
,
useTagStore
}
from
"@/store/module"
;
import
{
useMemoStore
,
useUserStore
}
from
"@/store/v1"
;
import
{
MemoRelation
,
MemoRelation_Type
}
from
"@/types/proto/api/v2/memo_relation_service"
;
...
...
@@ -50,8 +51,6 @@ const MemoEditor = (props: Props) => {
const
{
className
,
editorClassName
,
cacheKey
,
memoId
,
parentMemoId
,
autoFocus
,
onConfirm
}
=
props
;
const
{
i18n
}
=
useTranslation
();
const
t
=
useTranslate
();
const
contentCacheKey
=
`memo-editor-
${
cacheKey
}
`
;
const
[
contentCache
,
setContentCache
]
=
useLocalStorage
<
string
>
(
contentCacheKey
,
""
);
const
{
state
:
{
systemStatus
},
}
=
useGlobalStore
();
...
...
@@ -59,6 +58,7 @@ const MemoEditor = (props: Props) => {
const
memoStore
=
useMemoStore
();
const
resourceStore
=
useResourceStore
();
const
tagStore
=
useTagStore
();
const
currentUser
=
useCurrentUser
();
const
[
state
,
setState
]
=
useState
<
State
>
({
memoVisibility
:
Visibility
.
PRIVATE
,
resourceList
:
[],
...
...
@@ -69,6 +69,8 @@ const MemoEditor = (props: Props) => {
const
[
hasContent
,
setHasContent
]
=
useState
<
boolean
>
(
false
);
const
editorRef
=
useRef
<
EditorRefActions
>
(
null
);
const
userSetting
=
userStore
.
userSetting
as
UserSetting
;
const
contentCacheKey
=
`
${
currentUser
.
name
}
-
${
cacheKey
||
""
}
`
;
const
[
contentCache
,
setContentCache
]
=
useLocalStorage
<
string
>
(
contentCacheKey
,
""
);
const
referenceRelations
=
memoId
?
state
.
relationList
.
filter
(
(
relation
)
=>
relation
.
memoId
===
memoId
&&
relation
.
relatedMemoId
!==
memoId
&&
relation
.
type
===
MemoRelation_Type
.
REFERENCE
,
...
...
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