-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bump azure-devops-extension-sdk from 2.0.11 to 4.0.2 in /src/frontend #1103
base: main
Are you sure you want to change the base?
Bump azure-devops-extension-sdk from 2.0.11 to 4.0.2 in /src/frontend #1103
Conversation
Bumps [azure-devops-extension-sdk](https://github.com/Microsoft/azure-devops-extension-sdk) from 2.0.11 to 4.0.2. - [Commits](https://github.com/Microsoft/azure-devops-extension-sdk/commits) --- updated-dependencies: - dependency-name: azure-devops-extension-sdk dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]>
…evops-extension-sdk-4.0.2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR bumps the azure-devops-extension-sdk from version 2.0.11 to 4.0.2 and refactors the code to use a new SDKContext provided by a dedicated SDKProvider.
- Introduces SDKProvider and SDKContext to wrap and manage the SDK initialization
- Replaces direct calls to azure-devops-extension-sdk functions with calls via the SDKContext
- Updates multiple utilities and component files to support the new context-driven pattern
Reviewed Changes
Copilot reviewed 11 out of 13 changed files in this pull request and generated 9 comments.
Show a summary per file
File | Description |
---|---|
src/frontend/utilities/userIdentityHelper.tsx | Refactored to obtain the current user via SDKContext instead of the deprecated getUser |
src/frontend/utilities/servicesHelper.tsx | Updated service calls to use SDKContext for service retrieval |
src/frontend/utilities/azureDevOpsContextHelper.tsx | Switched from getHost to using SDKContext to get the host information |
src/frontend/index.tsx | Wrapped the application with SDKProvider |
src/frontend/dal/reflectBackendService.tsx | Changed to use SDKContext for obtaining the app token |
src/frontend/dal/dataService.tsx | Refactored to get access token and service via SDKContext |
src/frontend/dal/azureDevOpsContextProvider.tsx | Introduced SDKContext and SDKProvider for managing the SDK instance |
src/frontend/components/feedbackBoardContainer.tsx | Updated navigation service calls using SDKContext |
src/frontend/components/boardSummary.tsx | Refactored to retrieve work item services through SDKContext |
src/frontend/components/actionItemDisplay.tsx | Updated to use SDKContext when retrieving services and user info |
src/frontend/components/actionItem.tsx | Modified to use SDKContext for service retrieval when handling actions |
Files not reviewed (2)
- src/frontend/package-lock.json: Language not supported
- src/frontend/package.json: Language not supported
Comments suppressed due to low confidence (2)
src/frontend/components/actionItemDisplay.tsx:69
- Ensure that invoking React.useContext here is within a valid React functional component’s body. If this function is not a component, consider refactoring it as a custom hook.
const { SDK } = React.useContext(SDKContext);
src/frontend/components/actionItem.tsx:73
- Using a hook such as React.useContext in this function may be problematic if it’s not part of a functional component or custom hook. Refactor to retrieve context in a compliant manner.
const { SDK } = React.useContext(SDKContext);
@@ -8,7 +9,8 @@ let userIdentity: IdentityRef; | |||
*/ | |||
export const getUserIdentity = (): IdentityRef => { | |||
if (!userIdentity){ | |||
const currentUser: IUserContext = getUser(); | |||
const { SDK } = React.useContext(SDKContext); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using React.useContext inside a non-component function may violate React Hooks rules. Consider refactoring this utility to a custom hook or ensuring it’s only called within a functional component.
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
|
||
/** | ||
* Get the project info | ||
*/ | ||
const getProjectInfo = async (): Promise<IProjectInfo> => { | ||
const projectPageService = await getService<IProjectPageService>(CommonServiceIds.ProjectPageService); | ||
const { SDK } = React.useContext(SDKContext); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using React.useContext in a utility function (outside of a React component) can lead to hook rule violations. Consider moving this logic into a custom hook or passing the context as an argument.
const { SDK } = React.useContext(SDKContext); | |
const SDK = useSDK(); |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
@@ -15,7 +16,8 @@ const internalOrgNames = [ | |||
* Returns whether the current org in VSTS context is a recognized internal org. | |||
*/ | |||
export const isInternalOrg = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using React.useContext in a non-component function may result in unexpected behavior due to hook rules. Refactor this access to occur within a functional component or custom hook.
export const isInternalOrg = () => { | |
export const useIsInternalOrg = () => { |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
@@ -81,7 +82,9 @@ class ReflectBackendService { | |||
return that._appToken; | |||
} | |||
|
|||
return Promise.resolve(getAppToken().then((appToken) => { | |||
const { SDK } = React.useContext(SDKContext); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Invoking React.useContext in a non-component function could violate hook rules. Consider refactoring this logic into a custom hook or ensuring it’s used within a valid React component.
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
async function getDataService(): Promise<IExtensionDataManager> { | ||
if (!extensionDataManager) { | ||
const accessToken = await getAccessToken(); | ||
const extensionDataService = await getService<IExtensionDataService>(CommonServiceIds.ExtensionDataService); | ||
extensionDataManager = await extensionDataService.getExtensionDataManager(getExtensionContext().id, accessToken); | ||
const { SDK } = React.useContext(SDKContext); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Directly using React.useContext in this utility function may breach React Hook rules. Refactor to use a custom hook or pass the SDK context from a parent component.
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
@@ -252,13 +252,15 @@ class FeedbackBoardContainer extends React.Component<FeedbackBoardContainerProps | |||
} | |||
|
|||
private async updateUrlWithBoardAndTeamInformation(teamId: string, boardId: string) { | |||
getService<IHostNavigationService>(CommonServiceIds.HostNavigationService).then(service => { | |||
const { SDK } = React.useContext(SDKContext); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While integrating SDKContext in a component, ensure that React.useContext is used within the render flow. Verify that this usage adheres to hook rules given the function’s context.
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
service.setHash(`teamId=${teamId}&boardId=${boardId}`); | ||
}); | ||
} | ||
|
||
private async parseUrlForBoardAndTeamInformation(): Promise<{ teamId: string, boardId: string }> { | ||
const service = await getService<IHostNavigationService>(CommonServiceIds.HostNavigationService); | ||
const { SDK } = React.useContext(SDKContext); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Repeated use of React.useContext in the same component should be consolidated if possible. Consider retrieving the SDK context once and reusing it to avoid potential misuse of hooks.
const { SDK } = React.useContext(SDKContext); | |
const { SDK } = this.sdkContext; |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
onActionItemClick: async (id: number) => { | ||
const workItemNavSvc = await getService<IWorkItemFormNavigationService>(WorkItemTrackingServiceIds.WorkItemFormNavigationService); | ||
const { SDK } = React.useContext(SDKContext); | ||
const workItemNavSvc = await SDK.getService<IWorkItemFormNavigationService>(WorkItemTrackingServiceIds.WorkItemFormNavigationService); | ||
await workItemNavSvc.openWorkItem(id); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure that using React.useContext within this callback complies with the Rules of Hooks. If this function is not a React component or custom hook, refactor accordingly.
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
const { SDK } = React.useContext(SDKContext); | ||
const workItemNavSvc = await SDK.getService<IWorkItemFormNavigationService>(WorkItemTrackingServiceIds.WorkItemFormNavigationService); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using React.useContext inside this event handler might violate hook rules if it isn’t within a proper React component context. Consider refactoring to retrieve context once within the component.
const { SDK } = React.useContext(SDKContext); | |
const workItemNavSvc = await SDK.getService<IWorkItemFormNavigationService>(WorkItemTrackingServiceIds.WorkItemFormNavigationService); | |
const workItemNavSvc = await this.sdk.getService<IWorkItemFormNavigationService>(WorkItemTrackingServiceIds.WorkItemFormNavigationService); |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
Bumps azure-devops-extension-sdk from 2.0.11 to 4.0.2.
Commits
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot show <dependency name> ignore conditions
will show all of the ignore conditions of the specified dependency@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)