Sp-dev-docs: 馃悶SPFx v1.8.1 Regression with MSFT Teams Tabs?

Created on 23 Apr 2019  路  4Comments  路  Source: SharePoint/sp-dev-docs

Category

  • [ ] Question
  • [ ] Typo
  • [x] 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
spfx-general fixed-next-drop tracked bug-suspected

Most helpful comment

So, bit of background. The public typings generation process went squirelly when we released 1.8.0, and it was fixed for 1.8.1. However, it looks like the microsoftTeams property didn't get moved from beta -> public, so when the typings cleanup process ran, it removed it from the public typings. For now, you can work around this by including the beta packages. We will fix this in the next drop. Thanks for the heads up.

All 4 comments

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

So, bit of background. The public typings generation process went squirelly when we released 1.8.0, and it was fixed for 1.8.1. However, it looks like the microsoftTeams property didn't get moved from beta -> public, so when the typings cleanup process ran, it removed it from the public typings. For now, you can work around this by including the beta packages. We will fix this in the next drop. Thanks for the heads up.

Fixed with the 1.8.2 release, so closing this from here. Thanks for reporting this and sorry for the inconvenience caused by this regression.

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mikeparkie picture mikeparkie  路  3Comments

acksoft picture acksoft  路  3Comments

jonthenerd picture jonthenerd  路  3Comments

bengtmoss picture bengtmoss  路  3Comments

StfBauer picture StfBauer  路  3Comments