Skip to content

Commit 0d20106

Browse files
committed
fix(syncFolder): Remote deleted folder issue fixed.
1 parent c56da28 commit 0d20106

File tree

3 files changed

+74
-47
lines changed

3 files changed

+74
-47
lines changed

src/components/PendingStatsView.module.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
.view-container {
2+
display: flex;
3+
flex-direction: column;
4+
height: 100%;
5+
padding-bottom: 22px;
6+
}
7+
18
.header {
29
text-align: center;
310
width: 100%;
@@ -29,6 +36,15 @@
2936
transform: rotateZ(45deg);
3037

3138
}
39+
.scroll-container {
40+
overflow-y: scroll;
41+
-ms-overflow-style: none; /* Internet Explorer 10+ */
42+
scrollbar-width: none; /* Firefox */
43+
}
44+
45+
.scroll-container::-webkit-scrollbar {
46+
display: none; /* Safari and Chrome */
47+
}
3248
.empty-report {
3349
display: flex;
3450
flex-direction: column;

src/components/PendingStatsView.tsx

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -85,56 +85,58 @@ export const PendingStatsViewComponent = (props: { plugin: InvioPlugin }) => {
8585
</>
8686
}
8787
return (
88-
<>
88+
<div className={styles['viewContainer']}>
8989
<h4 className={styles['header']}>
9090
<Logo className={styles['icon']} />
9191
Touched Files Status
9292
<Cog className={styles['settings']} onClick={openSettings} />
9393
</h4>
94-
{
95-
treeToLocalData?.length > 0 ?
96-
<>
97-
<div className={styles['subHeader']}>Online Changed Files</div>
98-
<Tree
99-
checkable
100-
showLine
101-
defaultExpandAll
102-
multiple={false}
103-
rootStyle={{
104-
background: 'black',
105-
color: 'white',
106-
paddingTop: '18px',
107-
paddingBottom: '18px',
108-
}}
109-
selectedKeys={[]}
110-
onSelect={onToLocalSelect}
111-
onCheck={onToLocalCheck}
112-
treeData={treeToLocalData}
113-
/>
114-
</> :
115-
null
116-
}
117-
118-
<div className={styles['subHeader']}>Local Changed Files</div>
119-
<Tree
120-
checkable
121-
showLine
122-
defaultExpandAll
123-
multiple={false}
124-
rootStyle={{
125-
background: 'black',
126-
color: 'white',
127-
paddingTop: '18px',
128-
paddingBottom: '18px',
129-
}}
130-
selectedKeys={[]}
131-
onSelect={onToRemoteSelect}
132-
onCheck={onToRemoteCheck}
133-
treeData={treeToRemoteData}
134-
/>
135-
<div className={styles['actions']}>
136-
<Button onClick={startSync}>Sync</Button>
94+
<div className={styles['scrollContainer']}>
95+
{
96+
treeToLocalData?.length > 0 ?
97+
<>
98+
<div className={styles['subHeader']}>Online Changed Files</div>
99+
<Tree
100+
checkable
101+
showLine
102+
defaultExpandAll
103+
multiple={false}
104+
rootStyle={{
105+
background: 'black',
106+
color: 'white',
107+
paddingTop: '18px',
108+
paddingBottom: '18px',
109+
}}
110+
selectedKeys={[]}
111+
onSelect={onToLocalSelect}
112+
onCheck={onToLocalCheck}
113+
treeData={treeToLocalData}
114+
/>
115+
</> :
116+
null
117+
}
118+
119+
<div className={styles['subHeader']}>Local Changed Files</div>
120+
<Tree
121+
checkable
122+
showLine
123+
defaultExpandAll
124+
multiple={false}
125+
rootStyle={{
126+
background: 'black',
127+
color: 'white',
128+
paddingTop: '18px',
129+
paddingBottom: '18px',
130+
}}
131+
selectedKeys={[]}
132+
onSelect={onToRemoteSelect}
133+
onCheck={onToRemoteCheck}
134+
treeData={treeToRemoteData}
135+
/>
136+
<div className={styles['actions']}>
137+
<Button onClick={startSync}>Sync</Button>
138+
</div>
137139
</div>
138-
</>
140+
</div>
139141
);
140142
}

src/sync.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ const isSkipItem = (
411411
}
412412
}
413413
}
414-
if (watchDir && !key.startsWith(watchDir)) {
414+
if (watchDir && !key.startsWith(watchDir.endsWith('/') ? watchDir : (watchDir + '/'))) {
415415
return true;
416416
}
417417

@@ -614,7 +614,16 @@ const ensembleMixedStates = async (
614614
} else {
615615
results[key] = r;
616616

617-
results[key].existLocal = false;
617+
const localStats = await vault.adapter.stat(key)
618+
if (localStats?.type === 'folder') {
619+
results[key].existLocal = true;
620+
results[key].mtimeLocal = localStats.mtime
621+
results[key].mtimeLocalFmt = unixTimeToStr(localStats.mtime);
622+
results[key].sizeLocal = localStats.size;
623+
results[key].sizeLocalEnc = localStats.size;
624+
} else {
625+
results[key].existLocal = false;
626+
}
618627
results[key].existRemote = false;
619628
}
620629
}

0 commit comments

Comments
 (0)