Skip to content

Conversation

@akowalska622
Copy link
Contributor

@akowalska622 akowalska622 commented Dec 2, 2025

Summary

Resolves: #244365

This pull request improves the handling and display of recently closed tabs in the TabsBarMenu component. The main changes include enhancing how closed timestamps are managed and displayed, and updating the UI to show relative time for closed tabs.

Screenshot 2025-12-02 at 12 59 39

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

  • Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
  • This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.
  • Flaky Test Runner was used on any tests changed
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines
  • Review the backport guidelines and apply applicable backport:* labels.

Identify risks

Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging.

@akowalska622 akowalska622 self-assigned this Dec 2, 2025
@akowalska622 akowalska622 added Feature:Discover Discover Application enhancement New value added to drive a business result release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// Feature:DiscoverTabs Tabs feature within Discover labels Dec 2, 2025
@akowalska622 akowalska622 requested a review from l-suarez December 2, 2025 12:09
@akowalska622
Copy link
Contributor Author

/ci

@akowalska622 akowalska622 marked this pull request as ready for review December 3, 2025 14:58
@akowalska622 akowalska622 requested a review from a team as a code owner December 3, 2025 14:58
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

Comment on lines 174 to 179
const menuButton = await screen.findByTestId(tabsBarMenuButtonTestId);
await user.click(menuButton);

expect(await screen.findByText('Recently closed')).toBeInTheDocument();
expect(await screen.findByText(/5 minutes ago/i)).toBeInTheDocument();
expect(await screen.findByText(/10 minutes ago/i)).toBeInTheDocument();
Copy link
Contributor

@AlexGPlay AlexGPlay Dec 3, 2025

Choose a reason for hiding this comment

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

do you need them to be findByTestId or can they be getByTestId?

Suggested change
const menuButton = await screen.findByTestId(tabsBarMenuButtonTestId);
await user.click(menuButton);
expect(await screen.findByText('Recently closed')).toBeInTheDocument();
expect(await screen.findByText(/5 minutes ago/i)).toBeInTheDocument();
expect(await screen.findByText(/10 minutes ago/i)).toBeInTheDocument();
const menuButton = screen.getByTestId(tabsBarMenuButtonTestId);
await user.click(menuButton);
expect(screen.getByTestId('Recently closed')).toBeInTheDocument();
expect(screen.getByTestId(/5 minutes ago/i)).toBeInTheDocument();
expect(screen.getByTestId(/10 minutes ago/i)).toBeInTheDocument();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion Alex! Tbh I was just following the same pattern as the whole file is using. It's perfectly fine this way though, would you like me to update the whole file?

On a separate note - was replacing findByText by getByTestId too unintentional in your suggestion or it was on purpose?

Copy link
Contributor

@AlexGPlay AlexGPlay Dec 3, 2025

Choose a reason for hiding this comment

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

No worries about the whole file, I guess this ones are fine for now 😄

Sorry no! I I just did a quick review and thought everything was byTestId - I guess it's just getByXX instead of findByXX 🙈

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thought so, thanks for clarifying 😁
I'll adjust the getter, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 43acb5c

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
discover 1.3MB 1.3MB +336.0B
lens 1.6MB 1.6MB +334.0B
total +670.0B

History

cc @akowalska622

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting enhancement New value added to drive a business result Feature:Discover Discover Application Feature:DiscoverTabs Tabs feature within Discover release_note:skip Skip the PR/issue when compiling release notes Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t//

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Discover] [Unified Tabs] Add relative time info when tab was closed

3 participants