From 85529c0e2d04d5f5531782061837baad310c6899 Mon Sep 17 00:00:00 2001 From: Collin Beczak Date: Fri, 5 Jun 2026 13:35:51 -0300 Subject: [PATCH] Show MR tags in review pane without requiring a refresh Request `includeTags=true` when fetching a task for review (both `fetchTaskForReview` and `loadNextReviewTask`) so the tags arrive with the task payload from the matching backend change. Also fix a state-tracking bug in `ReviewTaskControls.componentDidUpdate`: the task-switch branch could set `state.tags` to `""` (empty string) when the next task arrived without tags, after which the `state.tags === null` guard prevented later-arriving tags from ever populating. Use `!state.tags` and `tags || null` so empty-string state is treated the same as null. Fixes rdar://120004366. --- src/components/ReviewTaskControls/ReviewTaskControls.jsx | 8 +++++--- src/services/Task/TaskReview/TaskReview.js | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/ReviewTaskControls/ReviewTaskControls.jsx b/src/components/ReviewTaskControls/ReviewTaskControls.jsx index 600893ab4..b2020d5fc 100644 --- a/src/components/ReviewTaskControls/ReviewTaskControls.jsx +++ b/src/components/ReviewTaskControls/ReviewTaskControls.jsx @@ -164,13 +164,15 @@ export class ReviewTaskControls extends Component { ); const tags = uniqueTagsArray.join(","); - if (tags.length > 0 && this.state.tags === null) { + // Empty `state.tags` (null or "") means the user hasn't edited yet, so + // it's safe to mirror in whatever the loaded task tags are once they arrive. + if (tags.length > 0 && !this.state.tags) { this.setState({ tags: tags }); } if (prevProps.task.id !== this.props.task.id) { - // Clear tags if we are on a new task - this.setState({ tags: tags ?? null }); + // Reset on task switch so the next task's tags can populate fresh. + this.setState({ tags: tags || null }); } } diff --git a/src/services/Task/TaskReview/TaskReview.js b/src/services/Task/TaskReview/TaskReview.js index 7ec07ed10..ceb0add4c 100644 --- a/src/services/Task/TaskReview/TaskReview.js +++ b/src/services/Task/TaskReview/TaskReview.js @@ -470,7 +470,7 @@ export const loadNextReviewTask = function (criteria = {}, lastTaskId, asMetaRev ); return function (dispatch) { - const params = { sort, order, ...searchParameters, asMetaReview }; + const params = { sort, order, ...searchParameters, asMetaReview, includeTags: true }; if (Number.isFinite(lastTaskId)) { params.lastTaskId = lastTaskId; } @@ -497,7 +497,7 @@ export const fetchTaskForReview = function (taskId, includeMapillary = false) { return new Endpoint(api.task.startReview, { schema: taskSchema(), variables: { id: taskId }, - params: { mapillary: includeMapillary }, + params: { mapillary: includeMapillary, includeTags: true }, }) .execute() .then((normalizedResults) => {