Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Remove react-timeago #7943

Merged
merged 9 commits into from
Aug 21, 2024
Merged

Refactor: Remove react-timeago #7943

merged 9 commits into from
Aug 21, 2024

Conversation

Tymek
Copy link
Member

@Tymek Tymek commented Aug 20, 2024

About the changes

Remove dependency 🫡
Replaced with 50 58 LoC + 140 LoTC, using date-fns

Related issues / Prior work

Important files

  • frontend/src/component/common/TimeAgo/TimeAgo.tsx
  • frontend/src/component/common/TimeAgo/TimeAgo.test.tsx

Copy link

vercel bot commented Aug 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 21, 2024 9:03am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Visit Preview Aug 21, 2024 9:03am

Copy link
Contributor

github-actions bot commented Aug 20, 2024

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Manifest Files

Copy link
Contributor

@thomasheartman thomasheartman left a comment

Choose a reason for hiding this comment

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

This is a cool change 😄 I'm very in favor of this overall, but have a few questions:

  1. Does this look exactly the same as before? There are no screenies attached, so I'm guessing it's a drop-in replacement visually?

  2. In what cases do we not want the component to update?

Question 2 is also pertinent to my inline comment regarding the props for that component. I'm not entirely convinced that the live?: number | boolean prop is the right way to format the API. But let's talk about it 💁🏼

frontend/src/component/common/TimeAgo/TimeAgo.tsx Outdated Show resolved Hide resolved
frontend/src/component/common/TimeAgo/TimeAgo.test.tsx Outdated Show resolved Hide resolved
const TimeAgo: FC<TimeAgoProps> = ({
date,
fallback = '',
refresh = true,
Copy link
Contributor

Choose a reason for hiding this comment

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

same point as before: it's weird to have an optional boolean prop default to true. We don't do that anywhere else as far as I'm aware. Would it make sense to use "negative" here instead, e.g. "dontRefresh", so that undefined and false have the same meaning?

Copy link
Member Author

Choose a reason for hiding this comment

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

We have it in

  • frontend/src/component/feature/StrategyTypes/FlexibleStrategy/FlexibleStrategy.tsx
  • frontend/src/component/project/ProjectList/ProjectGroup.tsx
  • frontend/src/component/common/FeatureStatusChip/FeatureStatusChip.tsx
  • frontend/src/component/changeRequest/ChangeRequest/Changes/Change/StrategyChange.tsx

@Tymek Tymek merged commit 6c5ce52 into main Aug 21, 2024
10 of 12 checks passed
@Tymek Tymek deleted the refactor/react-timeago branch August 21, 2024 10:03
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.

2 participants