-
Notifications
You must be signed in to change notification settings - Fork 74
Implement error node caching for improved TreeView user experience #2706
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: tnaum-ms <171359267+tnaum-ms@users.noreply.github.com>
Co-authored-by: tnaum-ms <171359267+tnaum-ms@users.noreply.github.com>
I updated the original implementation created by Copilot and simplified it. While working on it, I had to make Now, error nodes are being cached. In the example below the time-to-error is brief as I just modified my authentication details there, but this will kick-in for every error. This will improve the overall responsiveness of the tree view. Recording.2025-06-10.132733.mp4 |
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
Adds error node caching and retry support to tree data providers, improving refresh performance and user experience by preventing repeated failed operations and enabling explicit retries.
- Introduces
errorNodeCache
, retry-node creation, and reset logic inBaseCachedBranchDataProvider
- Defines
TreeElementWithRetryChildren
interface and merges context values for error/retry elements - Implements and registers
retryOperation
command to clear error state and refresh nodes
Reviewed Changes
Copilot reviewed 38 out of 38 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
src/tree/BaseCachedBranchDataProvider.ts | Added error-node cache, retry-node creation, and reset API |
src/tree/TreeElementWithRetryChildren.ts | New interface for retry-mode support |
src/tree/TreeElementWithContextValue.ts | Made contextValue mutable to allow dynamic updates |
src/commands/retryOperation/retryOperation.ts | Implemented retry command logic |
src/commands/registerCommands.ts | Registered azureDatabases.retryOperation command |
Multiple CosmosDB*ResourceItem.ts & Postgres*TreeItem.ts |
Removed readonly from contextValue for consistency |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@bk201- Would you have time to review that one for the upcoming release? It helps with the responsiveness of the tree view around error nodes, but in order to make it work, I made the |
@tnaum-ms |
@bk201- I'm integrating our error handling where vscode-cosmosdb/src/tree/BaseCachedBranchDataProvider.ts Lines 172 to 178 in e06cf3b
I considered adding extra information to the data provider's context, but that would require changes to every data provider we have. That’s why I ended up removing the |
Update
#2706 (comment)
Overview
This PR implements error node caching functionality to significantly improve user experience when dealing with failed tree nodes in the Azure Databases extension. Previously, when nodes failed due to authentication issues or connectivity problems, every tree refresh would retry the failed operation, causing delays and poor UX when multiple nodes were affected simultaneously.
Implementation
Core Changes
Enhanced
BaseCachedBranchDataProvider
:errorNodeCache
Map to store failed node states by parent IDgetChildren()
to check error cache first, preventing repeated failed operationsresetNodeErrorState()
method to clear error states for retry functionalityrefresh()
andpruneCache()
methodsNew Retry Command:
retryAuthentication
command that clears error state and refreshes nodesazureDatabases.retryAuthentication
Utility Functions:
hasRetryNode()
: Detects error nodes by checking for IDs ending with '/reconnect'createGenericElementWithContext()
: Creates tree elements with custom context valuesAutomatic Benefits for Target Providers
Both target providers automatically inherit the error caching functionality:
src/tree/azure-resources-view/cosmosdb/CosmosDBBranchDataProvider.ts
src/tree/workspace-view/cosmosdb/CosmosDBWorkspaceBranchDataProvider.ts
No changes were needed to these files since they extend the enhanced
BaseCachedBranchDataProvider
.User Experience Improvements
Before:
After:
Example Usage
When a connection fails due to invalid credentials:
Testing
This implementation follows the exact pattern successfully used in the DocumentDB extension, providing the same user experience improvements while maintaining minimal code changes.
Fixes #2700.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
update.code.visualstudio.com
node /home/REDACTED/work/vscode-cosmosdb/vscode-cosmosdb/node_modules/.bin/vscode-test
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.