Skip to content

Commit

Permalink
⚡ 体验优化
Browse files Browse the repository at this point in the history
backupList 使用缓存
  • Loading branch information
rowthan committed Jun 22, 2024
1 parent 29b984c commit e2c753b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/web/components/FooterSetting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function PopPanelSetting(props:{closedAfterChange: boolean}){
window.close();
}
}
if (mode === 'panel' && !isSidePanelInPath) {
if (mode === 'panel') {
if(!permission?.permissions?.includes('sidePanel')){
// 请求权限
toast({
Expand Down
2 changes: 1 addition & 1 deletion apps/web/components/account/DeviceInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function DeviceInfo() {
const newVersion = compare(version,whoAmI.version,'>')

return (
<a href={'https://pagenote.cn/release/?reuse=1&group=PAGENOTE'} target={'_blank'} className={'hover:underline flex items-center gap-1 text-xs cursor-pointer'}>
<a href={whoAmI.extensionStoreUrl||'https://pagenote.cn'} target={'_blank'} className={'hover:underline flex items-center gap-1 text-xs cursor-pointer'}>
{whoAmI.version}
{newVersion ? <PiArrowFatLinesUpFill className={'animation animate-bounce'} fill={'red'} /> : ''}
</a>
Expand Down
9 changes: 9 additions & 0 deletions apps/web/hooks/useBackupList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface FileItem {
url?: string,
}

const CACHE_DURATION = 10 * 1000

export default function useBackupList(type: 'oss'|'webdav'): [FileItem[],boolean] {
const { data = [], isLoading, mutate } = useSWR<FileItem[]>('/cloud/backup/list/'+type, fetchInfo)
Expand All @@ -26,6 +27,10 @@ export default function useBackupList(type: 'oss'|'webdav'): [FileItem[],boolean
filePath: '/backup',
}
},
},{
cacheControl:{
maxAgeMillisecond: CACHE_DURATION
}
}).then(function (res) {
return (res?.data || []).map(function (res: { filename: string }) {
return {
Expand All @@ -46,6 +51,10 @@ export default function useBackupList(type: 'oss'|'webdav'): [FileItem[],boolean
details: false,
}
},
},{
cacheControl:{
maxAgeMillisecond: CACHE_DURATION
}
}).then(function (res) {
return (res?.data || []).map(function (res: { filename: string }) {
console.log(res)
Expand Down

0 comments on commit e2c753b

Please sign in to comment.