mirror of
https://github.com/yume-chan/ya-webadb.git
synced 2025-10-03 01:39:21 +02:00
fix(file-manager): don't show items from other folder
This commit is contained in:
parent
aa212685e4
commit
37e82267bc
1 changed files with 12 additions and 1 deletions
|
@ -130,6 +130,10 @@ export const FileManager = withDisplayName('FileManager')((): JSX.Element | null
|
|||
const items: ListItem[] = [];
|
||||
const linkItems: AdbSyncEntryResponse[] = [];
|
||||
const intervalId = setInterval(() => {
|
||||
if (currentPath !== currentPathRef.current) {
|
||||
return;
|
||||
}
|
||||
|
||||
setItems(items.slice());
|
||||
}, 1000);
|
||||
|
||||
|
@ -138,7 +142,7 @@ export const FileManager = withDisplayName('FileManager')((): JSX.Element | null
|
|||
|
||||
for await (const entry of sync.opendir(currentPath)) {
|
||||
if (currentPath !== currentPathRef.current) {
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
if (entry.name === '.' || entry.name === '..') {
|
||||
|
@ -159,6 +163,10 @@ export const FileManager = withDisplayName('FileManager')((): JSX.Element | null
|
|||
}
|
||||
|
||||
for (const entry of linkItems) {
|
||||
if (currentPath !== currentPathRef.current) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!await sync.isDirectory(path.resolve(currentPath, entry.name!))) {
|
||||
entry.mode = (LinuxFileType.File << 12) | entry.permission;
|
||||
entry.size = 0;
|
||||
|
@ -167,6 +175,9 @@ export const FileManager = withDisplayName('FileManager')((): JSX.Element | null
|
|||
items.push(toListItem(entry));
|
||||
}
|
||||
|
||||
if (currentPath !== currentPathRef.current) {
|
||||
return;
|
||||
}
|
||||
setItems(items);
|
||||
listRef.current?.scrollToIndex(0);
|
||||
} finally {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue