Skip to content

Commit

Permalink
Fix browser race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
crschnick committed Jun 9, 2023
1 parent 20b96d7 commit 73e351d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -306,22 +306,21 @@ public void initFileSystem() throws Exception {
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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ public OpenFileSystemSavedState deserialize(JsonParser p, DeserializationContext
.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()))
Expand Down

0 comments on commit 73e351d

Please sign in to comment.