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
7817947f
Commit
7817947f
authored
Sep 22, 2024
by
johnnyjoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: clean duplicated requests
parent
1f7a90ce
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
15 deletions
+26
-15
TagsSection.tsx
web/src/components/HomeSidebar/TagsSection.tsx
+8
-1
AddMemoRelationPopover.tsx
...onents/MemoEditor/ActionButton/AddMemoRelationPopover.tsx
+3
-1
TagSelector.tsx
web/src/components/MemoEditor/ActionButton/TagSelector.tsx
+11
-10
index.tsx
web/src/components/MemoEditor/index.tsx
+0
-2
UserStatisticsView.tsx
web/src/components/UserStatisticsView.tsx
+4
-1
No files found.
web/src/components/HomeSidebar/TagsSection.tsx
View file @
7817947f
...
...
@@ -29,7 +29,14 @@ const TagsSection = (props: Props) => {
.
sort
((
a
,
b
)
=>
a
[
0
].
localeCompare
(
b
[
0
]))
.
sort
((
a
,
b
)
=>
b
[
1
]
-
a
[
1
]);
useDebounce
(()
=>
fetchTags
(),
300
,
[
memoList
.
size
(),
location
.
pathname
]);
useDebounce
(
()
=>
{
if
(
memoList
.
size
()
===
0
)
return
;
fetchTags
();
},
300
,
[
memoList
.
size
(),
location
.
pathname
],
);
const
fetchTags
=
async
()
=>
{
await
tagStore
.
fetchTags
({
user
,
location
});
...
...
web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx
View file @
7817947f
...
...
@@ -39,6 +39,8 @@ const AddMemoRelationPopover = (props: Props) => {
useDebounce
(
async
()
=>
{
if
(
!
popoverOpen
)
return
;
setIsFetching
(
true
);
try
{
const
filters
=
[
`creator == "
${
user
.
name
}
"`
,
`row_status == "NORMAL"`
];
...
...
@@ -57,7 +59,7 @@ const AddMemoRelationPopover = (props: Props) => {
setIsFetching
(
false
);
},
300
,
[
searchText
],
[
popoverOpen
,
searchText
],
);
const
getHighlightedContent
=
(
content
:
string
)
=>
{
...
...
web/src/components/MemoEditor/ActionButton/TagSelector.tsx
View file @
7817947f
import
{
Dropdown
,
IconButton
,
Menu
,
MenuButton
}
from
"@mui/joy"
;
import
{
HashIcon
}
from
"lucide-react"
;
import
{
use
Effect
,
use
Ref
,
useState
}
from
"react"
;
import
{
useRef
,
useState
}
from
"react"
;
import
useClickAway
from
"react-use/lib/useClickAway"
;
import
OverflowTip
from
"@/components/kit/OverflowTip"
;
import
useAsyncEffect
from
"@/hooks/useAsyncEffect"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
{
useTagStore
}
from
"@/store/v1"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
...
...
@@ -21,15 +22,15 @@ const TagSelector = (props: Props) => {
const
tags
=
tagStore
.
sortedTags
();
const
user
=
useCurrentUser
();
use
Effect
(
()
=>
{
(
async
()
=>
{
try
{
await
tagStore
.
fetchTags
({
user
});
}
catch
(
error
)
{
// do nothing.
}
}
)();
},
[]);
use
AsyncEffect
(
async
()
=>
{
if
(
!
open
)
return
;
try
{
await
tagStore
.
fetchTags
({
user
});
}
catch
(
error
)
{
// do nothing.
}
},
[
open
]);
useClickAway
(
containerRef
,
()
=>
{
setOpen
(
false
);
...
...
web/src/components/MemoEditor/index.tsx
View file @
7817947f
...
...
@@ -312,7 +312,6 @@ const MemoEditor = (props: Props) => {
memoPatch
.
relations
=
state
.
relationList
;
}
const
memo
=
await
memoStore
.
updateMemo
(
memoPatch
,
updateMask
);
await
memoStore
.
getOrFetchMemoByName
(
memo
.
name
,
{
skipCache
:
true
});
if
(
onConfirm
)
{
onConfirm
(
memo
.
name
);
}
...
...
@@ -338,7 +337,6 @@ const MemoEditor = (props: Props) => {
})
.
then
((
memo
)
=>
memo
);
const
memo
=
await
request
;
await
memoStore
.
getOrFetchMemoByName
(
memo
.
name
,
{
skipCache
:
true
});
if
(
onConfirm
)
{
onConfirm
(
memo
.
name
);
}
...
...
web/src/components/UserStatisticsView.tsx
View file @
7817947f
...
...
@@ -9,7 +9,7 @@ import { memoServiceClient } from "@/grpcweb";
import
useAsyncEffect
from
"@/hooks/useAsyncEffect"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
i18n
from
"@/i18n"
;
import
{
useMemoFilterStore
,
useMemoStore
}
from
"@/store/v1"
;
import
{
useMemoFilterStore
,
useMemo
List
,
useMemo
Store
}
from
"@/store/v1"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
ActivityCalendar
from
"./ActivityCalendar"
;
import
{
Popover
,
PopoverContent
,
PopoverTrigger
}
from
"./ui/Popover"
;
...
...
@@ -25,6 +25,7 @@ const UserStatisticsView = () => {
const
t
=
useTranslate
();
const
currentUser
=
useCurrentUser
();
const
memoStore
=
useMemoStore
();
const
memoList
=
useMemoList
();
const
memoFilterStore
=
useMemoFilterStore
();
const
[
memoAmount
,
setMemoAmount
]
=
useState
(
0
);
const
[
memoStats
,
setMemoStats
]
=
useState
<
UserMemoStats
>
({
link
:
0
,
taskList
:
0
,
code
:
0
,
incompleteTasks
:
0
});
...
...
@@ -34,6 +35,8 @@ const UserStatisticsView = () => {
const
days
=
Math
.
ceil
((
Date
.
now
()
-
currentUser
.
createTime
!
.
getTime
())
/
86400000
);
useAsyncEffect
(
async
()
=>
{
if
(
memoList
.
size
()
===
0
)
return
;
const
{
entities
}
=
await
memoServiceClient
.
listMemoProperties
({
name
:
`memos/-`
,
});
...
...
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