Skip to content

npm start should reuse the currently open tab #38

Closed
@gaearon

Description

@gaearon

It is annoying to restart and have a new tab opened every time.
I’m not sure how to do it but we should try to refresh the existing tab instead of opening a new one.

Activity

vjeux

vjeux commented on Jul 20, 2016

@vjeux
Contributor

Yeah, there's an issue on Chrome where they don't want to implement that feature, but I've read that you can use applescript in order to do that. @frantic is doing something similar for the react native chrome debugger opening.

gaearon

gaearon commented on Jul 20, 2016

@gaearon
ContributorAuthor

There’s also a Chrome extension that does it out of the box.
Maybe we can point people to it, assuming it’s easy to install: https://github.com/mbhutton/chrome-duplicate-tab-detector

gaearon

gaearon commented on Jul 20, 2016

@gaearon
ContributorAuthor

(We can also add something like this to React DevTools, assuming the port is more specific so we’re not handling false positives. Most people developing on React already have React DevTools.)

vjeux

vjeux commented on Jul 20, 2016

@vjeux
Contributor
vjeux

vjeux commented on Jul 20, 2016

@vjeux
Contributor

Here's the applescript that keeps the current tab: https://github.com/facebook/react-native/blob/f03c7b59fd8962682cff5797a3916882ef389871/packager/launchChromeDevTools.applescript

They replaced it with opn but check on the devserver if the tab with the websocket is already opened. Unfortunately we can't do that here because we don't maintain a running server.

gaearon

gaearon commented on Jul 20, 2016

@gaearon
ContributorAuthor

It’s not very nice to force people to use Chrome. After all our friends at Mozilla are building new Firefox debugger with React 😄 . Maybe there is some way to check if Chrome is the default browser?

vjeux

vjeux commented on Jul 20, 2016

@vjeux
Contributor

Absolutely, my previous solution checked if Chrome was opened before running it and the current one uses the default browser

gaearon

gaearon commented on Jul 20, 2016

@gaearon
ContributorAuthor

👍 We could then combine your check with AppleScript and fallback to opn.

added a commit that references this issue on Jul 21, 2016
7ff8cf1
added a commit that references this issue on Jul 21, 2016
37009b1
locked and limited conversation to collaborators on Jan 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @vjeux@gaearon

        Issue actions

          npm start should reuse the currently open tab · Issue #38 · facebook/create-react-app