Skip to content

chore(issues): Indicate duration when "Since First Seen" is selected#115533

Draft
amy-chen23 wants to merge 13 commits into
masterfrom
issues-indicate-duration
Draft

chore(issues): Indicate duration when "Since First Seen" is selected#115533
amy-chen23 wants to merge 13 commits into
masterfrom
issues-indicate-duration

Conversation

@amy-chen23
Copy link
Copy Markdown
Contributor

Resolves ID-1271.

On issues page, when filtering by time range, Since First Seen also displays duration.

@amy-chen23 amy-chen23 requested review from a team and shashjar May 13, 2026 23:41
@amy-chen23 amy-chen23 requested a review from a team as a code owner May 13, 2026 23:41
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 13, 2026

ID-1271

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 13, 2026

📊 Type Coverage Diff

✅ No new type safety issues introduced. Coverage: 93.63%

@roggenkemper
Copy link
Copy Markdown
Member

roggenkemper commented May 14, 2026

Screenshot 2026-05-13 at 9 14 22 PM
Screenshot 2026-05-13 at 9 14 18 PM
bubbling the first seen date to the trigger makes it more obvious when there's a mismatch between how we calculate that date and the first seen in the sidebar - not a blocker but something to be aware of

Comment thread static/app/views/issueDetails/streamline/eventDetailsHeader.tsx
@shashjar
Copy link
Copy Markdown
Member

@roggenkemper hmmm that's a good point. not sure there's an easy solution to this? i think we want the dropdown to remain consistent with the timeline chart, and the timeline chart definitely needs that query window wider than the actual first seen. maybe there's better text than "since first seen" that we could use?

@scttcper
Copy link
Copy Markdown
Member

this might be too confusing for issues that just started since we have a minimum time there. could try removing "since first seen" all together maybe

@shashjar
Copy link
Copy Markdown
Member

@amy-chen23 @roggenkemper got @scttcper stamp of approval on discussed approach of making dropdown time range same as actual first seen range, but keeping the query time range and timeline chart range as the extended versions

Comment thread static/app/views/issueDetails/streamline/eventDetailsHeader.tsx
Comment thread static/app/views/issueDetails/useGroupDefaultStatsPeriod.tsx Outdated
@scttcper
Copy link
Copy Markdown
Member

does make this sort of thing more apparent but i don't think it matters that much

image

Comment thread static/app/views/issueDetails/useGroupDefaultStatsPeriod.tsx Outdated
amy-chen23 and others added 2 commits May 18, 2026 14:28
Co-authored-by: Scott Cooper <scttcper@gmail.com>
}

/**
* Returns a short-form duration string (e.g. "19d", "3h") without converting to larger units like weeks, matching the sidebar's TimeSince display.
Copy link
Copy Markdown
Member

@shashjar shashjar May 19, 2026

Choose a reason for hiding this comment

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

Seems like the TimeSince display in the sidebar does use larger units, e.g. on this issue:

Image Image

Is it possible to just reuse the "2 months" that gets calculated for the sidebar? If that's difficult, I'm fine with always using days (or hours if less than 1 day)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yup, i can reuse the calculation from the sidebar

@amy-chen23 amy-chen23 marked this pull request as draft May 19, 2026 20:07
@amy-chen23 amy-chen23 marked this pull request as ready for review May 19, 2026 20:09
Comment thread static/app/views/issueDetails/streamline/eventDetailsHeader.tsx Outdated
Comment thread static/app/views/issueDetails/useGroupDefaultStatsPeriod.tsx Outdated
'Last %s (since first seen)',
getRelativeDate(group.firstSeen)
.replace(/^a /, '1 ')
.replace(/^an /, '1 ')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Menu label mismatches period

Medium Severity

The custom option key is still defaultStatsPeriod.statsPeriod, but its label now uses getRelativeDate(group.firstSeen) instead of getRelativeSummary on that period. The menu can describe a different "last" span than the relative value applied when the option is selected.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b5f89de. Configure here.

@amy-chen23 amy-chen23 marked this pull request as draft May 19, 2026 20:34
@amy-chen23

This comment was marked as outdated.

@amy-chen23 amy-chen23 marked this pull request as ready for review May 20, 2026 20:28
Comment thread static/app/views/issueDetails/streamline/eventDetailsHeader.tsx
Comment thread static/app/views/issueDetails/streamline/eventDetailsHeader.tsx Outdated
@amy-chen23 amy-chen23 marked this pull request as draft May 20, 2026 22:22
@amy-chen23 amy-chen23 marked this pull request as ready for review May 20, 2026 23:04
Comment on lines 153 to 162
shouldShowSinceFirstSeenOption
? {
[defaultStatsPeriod.statsPeriod]: t(
'%s (since first seen)',
getRelativeSummary(defaultStatsPeriod.statsPeriod)
'Last %s (since first seen)',
getRelativeDate(group.firstSeen)
.replace(/^a (?=\w+$)/, '1 ')
.replace(/^an (?=\w+$)/, '1 ')
),
}
: {}),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The custom "since first seen" dropdown label is overwritten by default options when an issue's age matches a standard period like 7d, 14d, or 30d.
Severity: LOW

Suggested Fix

To fix the label overwrite, move the ...props.defaultOptions spread before the custom "since first seen" option is defined within the relativeOptions callback. This will ensure that the custom label takes precedence over the default one for matching time periods, while still allowing other default options to be available.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: static/app/views/issueDetails/streamline/eventDetailsHeader.tsx#L153-L162

Potential issue: When an issue's age aligns with a standard relative period (e.g., 7,
14, or 30 days), the custom "Since First Seen" label in the stats period dropdown is
overwritten. This happens because the `...props.defaultOptions` spread, containing
generic labels like "Last 7 days", is applied after the custom option is defined,
replacing it. This results in a UI inconsistency where the dropdown's trigger button
correctly shows "Since First Seen", but the selected option within the dropdown displays
the generic label, creating a confusing user experience.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

known issue, will need another ticket to address this

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

There are 3 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f5cbc5a. Configure here.

export function shortenRelativeDate(relativeDate: string): string {
const match = relativeDate.match(/^(\d+|an?)\s+(\w+)$/);
if (!match) {
return '1m';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fallback produces misleading "1m" for very recent issues

Low Severity

shortenRelativeDate can't parse moment's "a few seconds" output (returned by fromNow(true) for issues less than ~45 seconds old) because the regex /^(\d+|an?)\s+(\w+)$/ only matches two-word strings. The fallback returns '1m' (1 minute), making the trigger display "Since First Seen (1m)" for an issue that's only seconds old. Similarly, the dropdown label's .replace(/^a (?=\w+$)/, '1 ') lookahead won't match "a few seconds" either, resulting in the awkward "Last a few seconds (since first seen)" text.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f5cbc5a. Configure here.

if (unit.startsWith('second')) {
return `${num}s`;
}
return '1m';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

shortenRelativeDate breaks for non-English locale users

Medium Severity

shortenRelativeDate parses English unit names (startsWith('month'), startsWith('day'), etc.), but getRelativeDate uses moment.fromNow(true) which returns locale-dependent strings. Since Sentry sets moment.locale(languageCode) for non-English users, the output will be e.g. "19 jours" (French) or "19 Tage" (German). All startsWith checks fail for these, so the function always returns the misleading fallback '1m'. The trigger would display "Since First Seen (1m)" for every non-English user regardless of actual duration. The same issue affects the .replace(/^a (?=\w+$)/, '1 ') regex in the dropdown label, which is also English-only.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f5cbc5a. Configure here.

@amy-chen23 amy-chen23 marked this pull request as draft May 21, 2026 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants