mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-21 23:20:23 +00:00
Fix browser race condition
This commit is contained in:
parent
20b96d7f25
commit
73e351d5ef
2 changed files with 5 additions and 3 deletions
|
@ -306,22 +306,21 @@ public final class OpenFileSystemModel {
|
|||
this.fileSystem = fs;
|
||||
this.local =
|
||||
fs.getShell().map(shellControl -> shellControl.isLocal()).orElse(false);
|
||||
this.initState();
|
||||
this.cache.init();
|
||||
});
|
||||
}
|
||||
|
||||
public void initWithGivenDirectory(String dir) throws Exception {
|
||||
initState();
|
||||
cdSyncWithoutCheck(dir);
|
||||
}
|
||||
|
||||
public void initWithDefaultDirectory() throws Exception {
|
||||
initState();
|
||||
savedState.cd(null);
|
||||
history.updateCurrent(null);
|
||||
}
|
||||
|
||||
private void initState() {
|
||||
void initState() {
|
||||
this.savedState = OpenFileSystemSavedState.loadForStore(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -71,6 +71,9 @@ public class OpenFileSystemSavedState {
|
|||
.constructCollectionLikeType(List.class, RecentEntry.class);
|
||||
List<RecentEntry> recentDirectories =
|
||||
JacksonMapper.getDefault().treeToValue(tree.remove("recentDirectories"), javaType);
|
||||
if (recentDirectories == null) {
|
||||
recentDirectories = List.of();
|
||||
}
|
||||
var cleaned = recentDirectories.stream()
|
||||
.map(recentEntry -> new RecentEntry(FileNames.toDirectory(recentEntry.directory), recentEntry.time))
|
||||
.filter(distinctBy(recentEntry -> recentEntry.getDirectory()))
|
||||
|
|
Loading…
Reference in a new issue