Skip to content

fix: add type guards when rendering env progression dates#1030

Merged
adityachoudhari26 merged 1 commit intomainfrom
env-progression-date-bug
Apr 22, 2026
Merged

fix: add type guards when rendering env progression dates#1030
adityachoudhari26 merged 1 commit intomainfrom
env-progression-date-bug

Conversation

@adityachoudhari26
Copy link
Copy Markdown
Member

fixes #1025

Copilot AI review requested due to automatic review settings April 22, 2026 21:06
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 22, 2026

Warning

Rate limit exceeded

@adityachoudhari26 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 11 minutes and 44 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 11 minutes and 44 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 16f98c0f-f605-4976-aeeb-1f674b66c8ec

📥 Commits

Reviewing files that changed from the base of the PR and between f686569 and d36a685.

📒 Files selected for processing (1)
  • apps/web/app/routes/ws/deployments/_components/environmentversiondecisions/rule-results/EnvironmentProgressionDetail.tsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch env-progression-date-bug

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a UI crash in the deployments view environment dialog by adding guards around rendering “time since” / “time until” strings when date values may be null or invalid.

Changes:

  • Added safeFormatDistanceToNowStrict to safely handle Date | string | null | undefined values before calling date-fns.
  • Refactored “Last success” and “re-check in …” rendering into dedicated components that return null when formatting can’t be performed.
  • Updated the environment progression row/card rendering to use the guarded formatting paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

{formatDistanceToNowStrict(new Date(rule.nextEvaluationAt))}
</span>
)}
{!allPassed && <NextEvaluationLine {...rule} />}
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

<NextEvaluationLine {...rule} /> spreads the entire RuleEvaluation object into a component that only needs nextEvaluationAt. This increases coupling (the component becomes implicitly dependent on RuleEvaluation’s shape) and can mask future prop name collisions. Pass nextEvaluationAt={rule.nextEvaluationAt} explicitly (and consider typing the prop as RuleEvaluation["nextEvaluationAt"] to keep it in sync).

Suggested change
{!allPassed && <NextEvaluationLine {...rule} />}
{!allPassed && (
<NextEvaluationLine nextEvaluationAt={rule.nextEvaluationAt} />
)}

Copilot uses AI. Check for mistakes.
@adityachoudhari26 adityachoudhari26 merged commit c5ed0d8 into main Apr 22, 2026
14 checks passed
@adityachoudhari26 adityachoudhari26 deleted the env-progression-date-bug branch April 22, 2026 21:14
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.

Unable to load environment dialog page in deployments view

2 participants