Skip to content

Conversation

@ashilkn
Copy link
Member

@ashilkn ashilkn commented Aug 29, 2025

Description

Previously, when _loadWithRetry returned null due to widget unmounting, the code incorrectly assumed the local file was deleted and would remove database reference of the file and which would trigger re-upload of the file.

…ding

Previously, when _loadWithRetry returned null due to widget unmounting,
the code incorrectly assumed the local file was deleted and would remove
database references or delete the file. This could lead to data loss.

Changes:
- Add new WidgetUnmountedException to centralized exceptions.dart for reuse
- Throw WidgetUnmountedException instead of returning null when widget unmounts
- Handle WidgetUnmountedException separately in error handler with appropriate logging
- Still set _errorLoadingLocalThumbnail flag to prevent retry attempts

Using Exception instead of Error follows Dart conventions:
- Exceptions are for recoverable runtime conditions (like widget unmounting)
- Errors are for programming mistakes that shouldn't be caught

This ensures that widget unmounting is properly distinguished from actual
file access failures.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@ashilkn ashilkn enabled auto-merge August 29, 2025 08:49
@ashilkn ashilkn merged commit c2b1ab8 into main Aug 29, 2025
1 of 2 checks passed
@ashilkn ashilkn deleted the fix-unmounted-widget-thumbnail-handling branch August 29, 2025 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants