Skip to content

Conversation

@Tatsinnit
Copy link
Member

Hiya, This PR should fixes #1681 which is a major upgrade and require some code changes, definitely need a good eyes @tejhan if you can please take a look and do bit of a testing as well please.

Explanation:

This PR updates the extension dependency @microsoft/vscode-azext-utils to ^4.0.0. The new azext-utils version includes typing and API changes that required a small fix in our createCredentialsForScopes implementation on the Azure account tree item. The change ensures correct type-safe handling of authentication scope requests that can be either an array of scopes or an AuthenticationWwwAuthenticateRequest object.

Background / Why

  • Upgrading @microsoft/vscode-azext-utils keeps us current with upstream improvements and bug fixes.
  • Version 4.0.0 introduces stricter typings and minor API changes; without the fix, TypeScript type errors or runtime issues could occur when constructing TokenCredential wrappers for Cloud Explorer interactions.
  • The createCredentialsForScopes handler previously assumed certain properties may exist and needed more robust type-checking and clearer error messages.

What changed

  • Bumped dependency: @microsoft/vscode-azext-utils → ^4.0.0
  • Implemented a defensive, typed handler for createCredentialsForScopes in azureAccountTreeItem.ts that:
    • Accepts either string[] or AuthenticationWwwAuthenticateRequest (from VS Code)
    • Safely extracts a scopes array from either input by checking scopeList or scopes properties on the request
    • Calls sessionProvider.getAuthSession({ scopes }) and throws a localized error when auth session is missing
    • Returns a minimal TokenCredential-like object with a getToken implementation to satisfy callers.

@Tatsinnit Tatsinnit requested review from Copilot and tejhan October 21, 2025 06:54
@Tatsinnit Tatsinnit self-assigned this Oct 21, 2025
@Tatsinnit Tatsinnit added bug Something isn't working dependencies Pull requests that update a dependency file labels Oct 21, 2025
Copy link
Contributor

Copilot AI left a 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 upgrades @microsoft/vscode-azext-utils to v4.0.0 and addresses breaking changes in its type definitions. Additionally, it fixes React hooks lint violations across multiple webview components by ensuring useEffect hooks properly manage state updates and dependencies.

Key Changes:

  • Updated @microsoft/vscode-azext-utils from ^3.5.1 to ^4.0.0 with corresponding type-safe implementation for authentication scope handling
  • Fixed React hooks violations by deferring synchronous state updates within effect bodies using setTimeout
  • Upgraded eslint-plugin-react-hooks to ^7.0.0 to enforce stricter React hooks rules

Reviewed Changes

Copilot reviewed 10 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
package.json Upgraded @microsoft/vscode-azext-utils to ^4.0.0
webview-ui/package.json Upgraded eslint-plugin-react-hooks to ^7.0.0
src/tree/azureAccountTreeItem.ts Added type-safe handling for authentication scope requests accepting either string arrays or AuthenticationWwwAuthenticateRequest objects
webview-ui/src/components/TextWithDropdown.tsx Deferred state update using setTimeout to prevent synchronous setState calls within useEffect
webview-ui/src/components/Dialog.tsx Refactored to use refs for latest prop values and added empty dependency arrays to prevent effect re-runs
webview-ui/src/components/CustomDropdown.tsx Deferred state update using setTimeout to prevent synchronous setState calls within useEffect
webview-ui/src/TestStyleViewer/TestStyleViewer.tsx Added dependency array and moved helper functions inside useEffect to run once on mount
webview-ui/src/Periscope/Periscope.tsx Added empty dependency array to useEffect to run once on mount
webview-ui/src/InspektorGadget/Traces.tsx Deferred state update using setTimeout to prevent synchronous setState calls within useEffect
webview-ui/src/InspektorGadget/InspektorGadget.tsx Deferred state update using setTimeout to prevent synchronous setState calls within useEffect
Files not reviewed (1)
  • webview-ui/package-lock.json: Language not supported

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Signed-off-by: Tatsat Mishra <tamishra@microsoft.com>
@Tatsinnit Tatsinnit force-pushed the fix/vscode-azext-utils-4.0.0 branch from 399d796 to 7cac264 Compare October 21, 2025 07:00
Signed-off-by: Tatsat Mishra <tamishra@microsoft.com>
Copy link
Collaborator

@tejhan tejhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally, LGTM.

@Tatsinnit Tatsinnit merged commit def8aa3 into Azure:main Oct 21, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants