in legacy/src/Calendar/Views.tsx [148:175]
private async initialize() {
const navSvc = await VSS.getService<IHostNavigationService>(VSS.ServiceIds.Navigation);
let selectedTeamId = (await navSvc.getCurrentState()).team;
if (!selectedTeamId) {
// Nothing in URL - check data service
const dataSvc = await VSS.getService<IExtensionDataService>(VSS.ServiceIds.ExtensionData);
selectedTeamId = await dataSvc.getValue<string>("selected-team-" + VSS.getWebContext().project.id, { scopeType: "User" });
}
if (!selectedTeamId) {
// Nothing in URL or data service - check context
const contextTeam = VSS.getWebContext().team;
if (contextTeam && contextTeam.id) {
selectedTeamId = contextTeam.id;
}
}
if (selectedTeamId) {
// get the team if we found a way to choose one
const team = await Tfs_Core_WebApi.getClient().getTeam(VSS.getWebContext().project.id, selectedTeamId);
if (team) {
await this.setSelectedTeam(team);
// Work around a bug where pivot bar wont render properly on initial render.
setTimeout(() => {
this.forceUpdate();
}, 250);
}
}
}