Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always trigger activation path load of folders - fix race condition on preemptive root directory creation #669

Merged
merged 2 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/web/client/dal/fileSystemProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,24 +108,22 @@ export class PortalsFS implements vscode.FileSystemProvider {
return await this._lookup(uri, false);
}

async readDirectory(uri: vscode.Uri): Promise<[string, vscode.FileType][]> {
async readDirectory(uri: vscode.Uri, isActivationFlow = false): Promise<[string, vscode.FileType][]> {
const result: [string, vscode.FileType][] = [];
const entry = await this._lookup(uri, true);

if (!entry && isValidDirectoryPath(uri.fsPath)) {
if (isActivationFlow && isValidDirectoryPath(uri.fsPath)) {
WebExtensionContext.telemetry.sendInfoTelemetry(
telemetryEventNames.WEB_EXTENSION_FETCH_DIRECTORY_TRIGGERED
);
await this._loadFromDataverseToVFS();
return result;
}

const entry = await this._lookup(uri, true);
if (entry instanceof Directory) {
for (const [name, child] of entry.entries) {
result.push([name, child.type]);
}
}

return result;
}

Expand Down
2 changes: 1 addition & 1 deletion src/web/client/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export function activate(context: vscode.ExtensionContext): void {
title: vscode.l10n.t("Fetching your file ..."),
},
async () => {
await portalsFS.readDirectory(WebExtensionContext.rootDirectory);
await portalsFS.readDirectory(WebExtensionContext.rootDirectory, true);
}
);

Expand Down
Loading