Skip to content

fix(ui): update task duration in real-time when filtering by status#8127

Merged
lotas merged 1 commit intotaskcluster:mainfrom
nitishagar:fix-8104
Feb 9, 2026
Merged

fix(ui): update task duration in real-time when filtering by status#8127
lotas merged 1 commit intotaskcluster:mainfrom
nitishagar:fix-8104

Conversation

@nitishagar
Copy link
Contributor

@nitishagar nitishagar commented Nov 28, 2025

When filtering tasks by status (e.g., clicking 'Running'), the Duration component was not updating in real-time. This was because react-window reuses component instances at each index, and when filtering changed which task appeared at a given index, the Duration component's interval was not properly reset.

The fix adds a key prop to the Duration (TimeDiff) component based on taskId and start time, ensuring proper component lifecycle management when the displayed task changes due to filtering or reordering.

Also adds unit tests for the Duration component covering:

  • Fixed duration display (completed tasks)
  • Real-time updates (running tasks)
  • Key prop handling for task switching
  • Interval cleanup when task completes

Fixes #8104

@nitishagar
Copy link
Contributor Author

@lotas / @matt-boris when you get a chance, can you review this change.

Copy link
Contributor

@lotas lotas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I feel like this should be fixed differently, because the root cause is not addressed

@nitishagar
Copy link
Contributor Author

Thanks for the review @lotas. The React.memo analysis was correct - the original fix addressed a symptom, not the cause. Updated to use itemKey on the List component, removed the TimeDiff key, and cleaned up test comments.

Would like your feedback on the update.

@lotas
Copy link
Contributor

lotas commented Jan 9, 2026

Thanks for the review @lotas. The React.memo analysis was correct - the original fix addressed a symptom, not the cause. Updated to use itemKey on the List component, removed the TimeDiff key, and cleaned up test comments.

Would like your feedback on the update.

great! Thanks for the update, looks like it fixes the issue.
Can you please run yarn lint to fix the tests please?

When filtering tasks by status (e.g., clicking 'Running'), the Duration
component was not updating in real-time. This was because react-window
reuses component instances at each index, and React.memo prevented
re-renders when filtering changed which task appeared at a given index.

The fix uses react-window's itemKey prop on the List component to ensure
proper component lifecycle management when the task at a given index
changes due to filtering or reordering. This causes React to unmount and
remount the row component when the task identity changes.

Also adds unit tests for:
- Duration component behavior (completed/running tasks, interval cleanup)
- TaskGroupTable itemKey prop ensuring correct taskId keys

Fixes taskcluster#8104
@nitishagar
Copy link
Contributor Author

@lotas Sorry for the delay. Finally got around to fixing this. Take a look when you get a chance.

@nitishagar
Copy link
Contributor Author

@lotas @matt-boris Pinging in relation to the above ^^

Copy link
Contributor

@lotas lotas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Thanks for the fix once again

@lotas lotas merged commit bb50efe into taskcluster:main Feb 9, 2026
73 checks passed
@nitishagar nitishagar deleted the fix-8104 branch February 17, 2026 06:06
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.

Task Group viewer task durations not updating when filtering by task status

2 participants