Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm start should reuse the currently open tab #38

Closed
gaearon opened this issue Jul 20, 2016 · 8 comments
Closed

npm start should reuse the currently open tab #38

gaearon opened this issue Jul 20, 2016 · 8 comments

Comments

@gaearon
Copy link
Contributor

gaearon commented Jul 20, 2016

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.

@vjeux
Copy link
Contributor

vjeux commented Jul 20, 2016

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
Copy link
Contributor Author

gaearon commented Jul 20, 2016

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
Copy link
Contributor Author

gaearon commented Jul 20, 2016

(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
Copy link
Contributor

vjeux commented Jul 20, 2016

@vjeux
Copy link
Contributor

vjeux commented Jul 20, 2016

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
Copy link
Contributor Author

gaearon commented Jul 20, 2016

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
Copy link
Contributor

vjeux commented Jul 20, 2016

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

@gaearon
Copy link
Contributor Author

gaearon commented Jul 20, 2016

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

gaearon added a commit that referenced this issue Jul 21, 2016
gaearon added a commit that referenced this issue Jul 21, 2016
@lock lock bot locked and limited conversation to collaborators Jan 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants