Skip to content

🐞SPFx v1.8.1 Regression with MSFT Teams Tabs? #3826

@andrewconnell

Description

@andrewconnell

Category

  • Question
  • Typo
  • Bug
  • Additional article idea

Expected or Desired Behavior

I believe this is a bug... as I can't find a mention of this in the release notes for 1.8.1.

In SPFx v1.8.1, when you create new SPFx project, you should be able to access the MSFT Teams context via this.context.microsoftTeams.... This worked in v1.8.0, but in 1.8.1, the microsoftTeams property is not defined.

Digging deeper, the BaseClientSideWebPart WebPartContext object appears to have changed from v1.8.0 => v1.8.1:

/* Excluded from this release type: microsoftTeams */

Whereas in SPFx 1.8.0 it was:

readonly microsoftTeams?: typeof teamsJs;

Observed Behavior

This code triggers a build error in an SPFx v1.8.1 web part project:

protected onInit(): Promise<void> {
  return new Promise<void>((resolve, reject) => {
    if (this.context.microsoftTeams) {
      this.context.microsoftTeams.getContext(context => {
        console.log('got teams context');
        resolve();
      });
    } else {
      resolve();
    }
  });
}

Steps to Reproduce

  • ensure install SPFx v1.8.1 is installed

  • create new SFPx web part

  • add the following code to the web part

    protected onInit(): Promise<void> {
      return new Promise<void>((resolve, reject) => {
        if (this.context.microsoftTeams) {
          this.context.microsoftTeams.getContext(context => {
            console.log('teams context', context);
            resolve();
          });
        } else {
          resolve();
        }
      });
    }
  • run gulp build & observe errors

  • repeat the same process above, but with SPFx v1.8.0 installed... observe it builds without error

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:spfxCategory: SharePoint Framework (not extensions related)status:fixed-next-dropIssue planned to be fixed in an upcoming release.status:trackedCurrently tracked with Microsoft’s internal issue tracking system. DO NOT ADD/REMOVE (MSFT managed)type:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions