Skip to content

Internal Polaris links are always opening new tab with wrong URL #1916

@key88sf

Description

@key88sf

Issue summary

Before opening this issue, I have:

  • [x ] Upgraded to the latest version of the package
    • shopify_app version: 22.4.0
    • Ruby version: 3.3.1
    • Operating system: Mac OS X Sonoma 14.6.1
  • [x ] Set log_level: :debug in my configuration, if applicable
  • [x ] Found a reliable way to reproduce the problem that indicates it's a problem with the package
  • [x ] Looked for similar issues in this repository
  • [x ] Checked that this isn't an issue with a Shopify API

Using Shopify App with app-bridge v.4, any relative links from Polaris components (Link, Button, etc) are opening in a new tab, and not using the proper shopify admin store URL.

Using the boilerplate Ruby shopify app from the app template (https://github.com/Shopify/shopify-app-template-ruby), I create a Polaris link like this: <Link url="/pagename">Click Me</Link> and then click the link.

Expected behavior

Clicking the polaris Link element above should change browser URL to: https://admin.shopify.com/store/mystore/apps/my-app/pagename (not opening new tab)

Actual behavior

Clicking the link opens a new tab, with URL: https://<cloudflare-tunnel-host>/pagename.

This URL is not using the shopify store URL at all -- it is just using the underlying Rails host name. It seems to be totally bypassing the React router.

This worked fine with App Bridge V3 --- since in the PolarisProvider.jsx class, it was using the AppBridge navigate() method. Now with AppBridge v4, that same class is now calling window.open(url) which ends up opening a new tab.

Steps to reproduce the problem

  1. Create a new Shopify App (ruby) using the Shopify App Template for Ruby
  2. Add a Polaris Link element to an internal app page (e.g. /pagename)
  3. Click the link in the app UI

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions