Skip to content

Add rollback logic for optimistic cache updates in assetsStore #8179

@coderabbitai

Description

@coderabbitai

Description

Add error handling and rollback logic for optimistic cache updates in updateAssetMetadata and updateAssetTags functions in src/stores/assetsStore.ts.

Currently, these functions update the cache optimistically before making the network request to assetService.updateAsset. If the network request fails, the UI state remains out of sync with the server state.

Enhancement

Implement rollback mechanism to:

  • Capture previous asset state(s) before optimistic update
  • Restore previous state(s) on network failure
  • Re-throw or handle errors appropriately after rollback

Context

Related PR: #8090
Discussion: #8090 (comment)
Requested by: @DrJKL

┆Issue is synchronized with this Notion page by Unito

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions