Work item feature - Update each widget to use features
**Phase 4**: Migrate all work item widget components to use the `features` field.
## Approach
Progressively update each widget component to access data from `features` instead of `widgets`, using the pattern `data.features || data.widgets` for graceful fallback. Each widget migration includes **both the read path (viewing work items) and write path (creating work items)**.
### Key Decision: Incremental Create Work Item Cache Updates
Instead of updating the entire create work item cache in one large effort, we'll **update each widget's create flow as part of its individual migration**. This approach:
- ✅ Reduces risk with smaller, testable changes
- ✅ Allows parallel progress across widgets
- ✅ Avoids big-bang integration issues
- ✅ Keeps each widget issue self-contained
## Steps for Each Widget Task
Each widget migration should follow this pattern:
### 1. **Update GraphQL Query Helper** (if applicable)
- Locate the widget's helper function in `app/assets/javascripts/work_items/utils.js`
- Update to use: `workItem?.features?.{widgetName} || workItem?.widgets?.find((widget) => widget.type === WIDGET_TYPE_{NAME})`
### 2. **Update Component Data Access**
- Review computed properties and methods accessing widget data
- Ensure they use the updated helper functions with fallback pattern
### 3. **Update Apollo Queries**
- In the `apollo` section, update `update()` functions to use new helpers
- Verify queries return both `features` and `widgets` for backward compatibility
### 4. **Update Create Work Item Cache** ⭐ NEW
- Update `app/assets/javascripts/work_items/graphql/cache_utils.js` for this widget
- Update `app/assets/javascripts/work_items/graphql/resolvers.js` if needed
- Ensure create flow writes both `features` and `widgets` to cache during migration
### 5. **Feature Flag Gating**
- Wrap features access behind `work_item_features_field` feature flag
- Use fallback to widgets if flag is disabled
### 6. **Testing**
- ✅ Verify viewing existing work items with the widget
- ✅ Verify creating new work items with the widget
- ✅ Test graceful fallback behavior
- ✅ Update related tests
---
**Total widgets to migrate:** 28 tasks (excluding NOTES which has dedicated issue [#587971](https://gitlab.com/gitlab-org/gitlab/-/issues/587971))
All widget migrations are gated behind the `work_item_features_field` feature flag for safe rollout.
issue