Skip to content

Commit

Permalink
Merge pull request #481 from us3r-network/F-botSave-bufan
Browse files Browse the repository at this point in the history
reconstruct SyncingBotSaves component
  • Loading branch information
sin-bufan authored Jan 23, 2024
2 parents 12ec0b9 + 5e29493 commit 7870e67
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions apps/u3/src/container/Save.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ const EmptyDesc = styled.span`

export default function Save() {
const { isFetching, personalFavors } = usePersonalFavors();
const [syncNum, setSyncNum] = useState(0);
const [savedLink, setSavedLink] = useState([]);
// console.log('personalFavors', personalFavors);
const list = useMemo(
() =>
uniqBy(
() => [
...uniqBy(
personalFavors
.filter((item) => !!item?.link && item.link.type !== 'test')
.map((item) => {
Expand Down Expand Up @@ -93,7 +93,12 @@ export default function Save() {
}),
'id'
),
[personalFavors]
...savedLink.map((item) => {
const createAt = item.createAt || new Date().getTime();
return { ...item, createAt };
}),
],
[personalFavors, savedLink]
);
const isEmpty = useMemo(() => list.length === 0, [list]);
return (
Expand All @@ -102,7 +107,7 @@ export default function Save() {
<SyncingBotSaves
onComplete={(saves) => {
console.log('onComplete SyncingBotSaves');
setSyncNum(saves.length);
setSavedLink(saves);
}}
/>
<ContentWrapper>
Expand Down

0 comments on commit 7870e67

Please sign in to comment.