There is a call to SDK.init()
in componentWillMount()
in many Azure DevOps extension samples.
For example here:
public async componentWillMount() {
SDK.init();
const repoSvc = await SDK.getService<IVersionControlRepositoryService>(GitServiceIds.VersionControlRepositoryService);
}
But componentWillMount()
is deprecated now. So where am I supposed to place this code?
Notice: I am also missing await
when calling SDK.init()
in this example. I suppose that it should be there.
After research of some existing plugins, there is a better way than move SDK.init()
to componentDidMount
:
I found the best way where to init in this plugin from Microsoft. Simply put SDK.init()
into your app.ts
import * as SDK from "azure-devops-extension-sdk";
SDK.init();