Skip to content

Conversation

@camielvs
Copy link
Collaborator

@camielvs camielvs commented Jan 14, 2026

Description

This adds a custom hook useNavigate that extends the existing React Router useNavigate to allow navigation to open in new tabs.

Specifically, it adds:

  1. a newTab prop to the navigate function. If true the url will open in a new tab. If false current behaviour is maintained.
  2. the hook tracks whether cmd/meta is held down when the navigate function executes and will open in a new tab as expected by usual link-clicking behaviour.

The PR then propagates this to all the places where I judged this additionally functionality would be desired. Implementation of the hook is as simple as replacing the import path for useNavigate, since the hook extends the React Router base hook (and thus the behaviour is unchanged when not opening in a new tab).

Related Issue and Pull requests

Closes https://github.com/Shopify/oasis-frontend/issues/423

Type of Change

  • New feature
  • Improvement

Checklist

  • I have tested this does not break current pipelines / runs functionality
  • I have tested the changes on staging

Screenshots (if applicable)

No visible change to ui

Test Instructions

For the areas where this hook has been implemented check that:

  • clicking as usual opens the url in the same tab (current behaviour)
  • you can now cmd + click to open in a new tab

Additional Comments

Copy link
Collaborator Author

camielvs commented Jan 14, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@camielvs camielvs force-pushed the 01-13-feat_usesmartnavigation_hook_for_opening_urls_in_a_new_tab branch from 8f5c8ed to 42b2488 Compare January 14, 2026 22:07
@camielvs camielvs force-pushed the 01-12-_chore_cmd-click_to_open_runs_in_a_new_tab branch from d3e8df4 to 71956b8 Compare January 14, 2026 22:07
@camielvs camielvs changed the title feat: useSmartNavigation hook for opening urls in a new tab feat: Extend useNavigate hook to allow opening urls in a new tab Jan 14, 2026
@camielvs camielvs force-pushed the 01-13-feat_usesmartnavigation_hook_for_opening_urls_in_a_new_tab branch from 42b2488 to 9999d20 Compare January 14, 2026 22:22
@camielvs camielvs changed the base branch from 01-12-_chore_cmd-click_to_open_runs_in_a_new_tab to graphite-base/1627 January 14, 2026 22:24
@camielvs camielvs force-pushed the 01-13-feat_usesmartnavigation_hook_for_opening_urls_in_a_new_tab branch from 9999d20 to e04aa29 Compare January 14, 2026 22:24
@camielvs camielvs changed the base branch from graphite-base/1627 to master January 14, 2026 22:24
@camielvs camielvs marked this pull request as ready for review January 14, 2026 22:38
@camielvs camielvs requested a review from a team as a code owner January 14, 2026 22:38
@camielvs camielvs force-pushed the 01-13-feat_usesmartnavigation_hook_for_opening_urls_in_a_new_tab branch 2 times, most recently from a5a3ec7 to 7551981 Compare January 15, 2026 18:17
@camielvs camielvs force-pushed the 01-13-feat_usesmartnavigation_hook_for_opening_urls_in_a_new_tab branch from 7551981 to 744a795 Compare January 15, 2026 18:24
@camielvs camielvs requested a review from Mbeaulne January 15, 2026 18:25
Copy link
Collaborator

@maxy-shpfy maxy-shpfy left a comment

Choose a reason for hiding this comment

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

It seems to be highly risky overkill.

According to the doc, <Link> component supports this cmd+click behavior out of the box.

So one simple change (dont look at the div - inlinestack for some reason failed in this case - need to investigate) will get exactly same behavior:

   <TableRow className="cursor-pointer text-gray-500 text-xs">
      <TableCell className="text-sm flex items-center gap-2">
        <Link to={clickThroughUrl}>
          <div className="flex items-center gap-2">
            <StatusIcon status={overallStatus} />
            <Paragraph className="truncate max-w-[400px]" title={name}>
              {name}
            </Paragraph>
            <span>{`#${runId}`}</span>
          </div>
        </Link>
      </TableCell>
      <TableCell>
        <div className="w-2/3">
          <StatusBar executionStatusStats={run.execution_status_stats} />
        </div>
      </TableCell>
      <TableCell>
        {run.created_at
          ? `${formatDate(convertUTCToLocalTime(run.created_at).toISOString())}`
          : "Data not found..."}
      </TableCell>
      <TableCell>
        {isTruncated ? createdByButtonWithTooltip : createdByButton}
      </TableCell>
    </TableRow>

Copy link
Collaborator Author

^ In some cases, such as RunRow the Link component will work, yes. But in others, such as OasisSubmitter & ClonePipeline it will not.

I made this because there are places where we need to programatically navigate to a url; not via a UI element.
For example:

  1. click a button (clone pipeline),
  2. it does some stuff (clones the pipeline)
  3. navigate to a new page (the new clone)

I'm currently not aware how that would be possible with the Link component (otherwise we would have already used it like we have elsewhere).

Copy link
Collaborator Author

Closing this, as discussed. We will go with #1645 for now.

@camielvs camielvs closed this Jan 16, 2026
camielvs added a commit that referenced this pull request Jan 20, 2026
## Description

<!-- Please provide a brief description of the changes made in this pull request. Include any relevant context or reasoning for the changes. -->

Add support for `cmd + click` to open pages in a new tab where doing so is triggered by a click action on a UI component.

Notably, this affects:
- Row Row
- Pipeline Row
- Inspect Pipeline
- Quick Start
- View Run (after submission)

## Related Issue and Pull requests

<!-- Link to any related issues using the format #<issue-number> -->
Closes Shopify/oasis-frontend#423

Supersedes #1627 

## Type of Change

<!-- Please delete options that are not relevant -->

- [x] New feature
- [x] Improvement

## Checklist

<!-- Please ensure the following are completed before submitting the PR -->

- [ ] I have tested this does not break current pipelines / runs functionality
- [ ] I have tested the changes on staging

## Screenshots (if applicable)

<!-- Include any screenshots that might help explain the changes or provide visual context -->

no UI changes

## Test Instructions

<!-- Detail steps and prerequisites for testing the changes in this PR -->

Check the places where navigation has been updated that existing behaviour persists, and cmd + click opens in a new tab.

## Additional Comments

<!-- Add any additional context or information that reviewers might need to know regarding this PR -->
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.

4 participants