Skip to content

Commit 5b6af07

Browse files
authored
Move opening default built-in walkthrough to after built-in walkthrough initialization (microsoft#181066)
1 parent 651bd24 commit 5b6af07

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,28 @@ export class GettingStartedPage extends EditorPane {
242242
}
243243
}));
244244

245-
this._register(this.gettingStartedService.onDidAddBuiltInWalkthrough(rerender));
245+
this._register(this.gettingStartedService.onDidAddBuiltInWalkthrough(() => {
246+
rerender();
247+
const someStepsComplete = this.gettingStartedCategories.some(category => category.steps.find(s => s.done));
248+
if (!this.productService.openToWelcomeMainPage && !someStepsComplete && !this.hasScrolledToFirstCategory) {
249+
const firstSessionDateString = this.storageService.get(firstSessionDateStorageKey, StorageScope.APPLICATION) || new Date().toUTCString();
250+
const daysSinceFirstSession = ((+new Date()) - (+new Date(firstSessionDateString))) / 1000 / 60 / 60 / 24;
251+
const fistContentBehaviour = daysSinceFirstSession < 1 ? 'openToFirstCategory' : 'index';
252+
253+
if (fistContentBehaviour === 'openToFirstCategory') {
254+
const first = this.gettingStartedCategories.filter(c => !c.when || this.contextService.contextMatchesRules(c.when))[0];
255+
this.hasScrolledToFirstCategory = true;
256+
if (first) {
257+
this.currentWalkthrough = first;
258+
this.editorInput.selectedCategory = this.currentWalkthrough?.id;
259+
this.buildCategorySlide(this.editorInput.selectedCategory, undefined);
260+
this.setSlide('details');
261+
return;
262+
}
263+
}
264+
}
265+
}));
266+
246267
this._register(this.gettingStartedService.onDidAddWalkthrough(rerender));
247268
this._register(this.gettingStartedService.onDidRemoveWalkthrough(rerender));
248269

@@ -872,29 +893,11 @@ export class GettingStartedPage extends EditorPane {
872893
}
873894
}
874895

875-
const someStepsComplete = this.gettingStartedCategories.some(category => category.steps.find(s => s.done));
876896
if (this.editorInput.showTelemetryNotice && this.productService.openToWelcomeMainPage) {
877897
const telemetryNotice = $('p.telemetry-notice');
878898
this.buildTelemetryFooter(telemetryNotice);
879899
footer.appendChild(telemetryNotice);
880-
} else if (!this.productService.openToWelcomeMainPage && !someStepsComplete && !this.hasScrolledToFirstCategory) {
881-
const firstSessionDateString = this.storageService.get(firstSessionDateStorageKey, StorageScope.APPLICATION) || new Date().toUTCString();
882-
const daysSinceFirstSession = ((+new Date()) - (+new Date(firstSessionDateString))) / 1000 / 60 / 60 / 24;
883-
const fistContentBehaviour = daysSinceFirstSession < 1 ? 'openToFirstCategory' : 'index';
884-
885-
if (fistContentBehaviour === 'openToFirstCategory') {
886-
const first = this.gettingStartedCategories.filter(c => !c.when || this.contextService.contextMatchesRules(c.when))[0];
887-
this.hasScrolledToFirstCategory = true;
888-
if (first) {
889-
this.currentWalkthrough = first;
890-
this.editorInput.selectedCategory = this.currentWalkthrough?.id;
891-
this.buildCategorySlide(this.editorInput.selectedCategory, undefined);
892-
this.setSlide('details');
893-
return;
894-
}
895-
}
896900
}
897-
898901
this.setSlide('categories');
899902
}
900903

0 commit comments

Comments
 (0)