Custom Task Status Optimization Test
โ
Optimization Implemented
The following components have been updated to use the shared useTaskStatusesStore instead of making direct API calls:
- EditableTaskStatus.vue (task, shot, asset versions)
- TaskBulkActionsMenu.vue
- ShotTaskStatusFilter.vue
- TaskStatusFilter.vue (asset version)
๐ง How the Optimization Works
The optimization eliminates N+1 API calls by:
- Shared Store: All components now use
useTaskStatusesStore
- Caching: Task statuses are cached for 5 minutes per project
- Single Request: Only one API call per project instead of one per component
- Cache Invalidation: Cache is invalidated when statuses are modified
๐งช Testing Instructions
To verify the optimization is working:
- Open browser Developer Tools (F12)
- Go to the Network tab
- Navigate to a page with multiple EditableTaskStatus components (e.g., shots table)
- Look for requests to
/projects/{id}/task-statuses
- Before optimization: You would see multiple identical requests
- After optimization: You should see only ONE request per project
๐ Expected Performance Improvement
For a shots table with 20 rows (each with multiple task status dropdowns):
Before: 20+ API calls to /projects/7/task-statuses
After: 1 API call to /projects/7/task-statuses
Improvement: ~95% reduction in API calls
๐ Cache Behavior
The store implements intelligent caching:
- Cache Duration: 5 minutes per project
- Automatic Invalidation: When statuses are created/updated/deleted
- Concurrent Request Handling: Multiple components requesting the same data will share the same API call
- Per-Project Isolation: Each project has its own cache entry
โ ๏ธ Components That Still Use Direct API Calls
The following component continues to use direct API calls (by design):
- CustomTaskStatusManager.vue: Management interface that creates/updates/deletes statuses
This component invalidates the store cache after making changes to ensure other components get fresh data.
๐ฏ Key Benefits
- Performance: Dramatically reduced API calls
- User Experience: Faster page loads and interactions
- Server Load: Reduced backend load from redundant requests
- Consistency: All components use the same cached data
- Maintainability: Centralized status management logic