Skip to content

Conversation

@adithya-naik
Copy link

@adithya-naik adithya-naik commented Jan 7, 2026

Fix Last Activity Calculation per Repository Item

What does this PR do?

Closes #440

This pull request fixes how the “Last Activity” time is calculated and displayed for each repository item.

Previously, the relative time logic was defined inside the component, which could lead to incorrect or inconsistent behavior across repository items.

This change ensures that each repository correctly computes and displays its own relative last-modified time.


Why is this change needed?

  • Hooks should not be defined inside components.
  • dayjs.extend(relativeTime) should be initialized once, not on every render.
  • Ensures React hook rules are followed.
  • Improves code clarity and correctness.

What was changed?

  • Moved dayjs.extend(relativeTime) to module scope.
  • Extracted useLastModified into a proper custom hook.
  • Ensured lastModified updates correctly when repository.last_modified changes.

Example

All repository items now correctly display their respective relative last activity times such as:

“2 years ago”

based on their individual last_modified values.


Technical Notes

  • No new dependencies added
  • No UI changes apart from fixing incorrect behavior
  • Fully backward-compatible

Checklist

  • React Hooks rules followed
  • Cleaner component structure
  • Accurate per-repository last activity display
  • No breaking changes

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.

Bug: last activity shows as "2 years ago" for all projects

1 participant