Opening a deleted Item loads indefinitely #2822
This pull request improves the reliability and user experience of reading documents in Cosmos DB by adding timeout handling, fallback logic, and clearer error messaging. The changes ensure that if a document read operation fails or times out, a fallback query by _rid is attempted, and users receive a more informative error message in the UI when a document cannot be found or retrieved.
Error Handling and Messaging Improvements:
- Added a new localized error message
"Item not found or request timed out"tobundle.l10n.jsonfor clearer user feedback when document retrieval fails. - Updated the error reporting in
DocumentSession.readto send adocumentErrorevent with the new message when a document cannot be found or read, instead of sending a generic or query error.
Timeouts and Fallback Logic:
- Implemented a 4-second timeout for both the primary document read and the fallback
_ridquery inDocumentSession, with appropriate logging and error handling for timeouts. [1] [2] [3] - Added fallback logic: if the primary read fails or times out, a secondary query by
_ridis attempted, and detailed logs are generated based on the results.
UI Improvements:
- Enhanced the document panel UI to display a loading state only when appropriate, and to show a user-friendly error message when a document cannot be loaded, such as when it is deleted externally or a timeout occurs.
Fixes #2822
@mkrueger I've opened a new pull request, #2858, to work on those changes. Once the pull request is ready, I'll request review from you.
@mkrueger I've opened a new pull request, #2864, to work on those changes. Once the pull request is ready, I'll request review from you.