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

Chrome 'open tab' reuse an empty tab when possible #1165

Merged
merged 4 commits into from
Dec 6, 2016

Conversation

n3tr
Copy link
Contributor

@n3tr n3tr commented Dec 5, 2016

Still WIP: need to clean up duplicated code and found some unexpected behavior (both in master and this branch)

on startscript - If there're no debugging tab (localhost:3000) open, we will try to use empty tab instead of create new one. (fixes #1157)

Test plan

To invoke script, We can use both npm/yarn start or run osascript openChrome.applescript localhost:3000 inside /packages/react-dev-utils folder .

  • No open chrome window: When chrome open with an empty tab, use the empty tab instead of create new one.
  • Chrome window with debugging tab: Reuse debugging tab.
  • Chrome window w/o debugging tab: Create new tab with url.
  • Chrome window w/o debugging tab, but have an empty tab: Use empty tab.
# Setup
npm run create-react-app my-app
cd my-app
yarn start

Test env

  • Browser: Google Chrome Version 54.0.2840.98
  • OS: macOS Sierra 10.12.1

@gaearon
Copy link
Contributor

gaearon commented Dec 5, 2016

Nice, thanks for looking into this! Let me know when it's more fleshed out.

@gaearon
Copy link
Contributor

gaearon commented Dec 6, 2016

We found a person who knows AppleScript.
😄

@n3tr
Copy link
Contributor Author

n3tr commented Dec 6, 2016

@gaearon I think it's ready for review 👍

Actually, It's my first time with Apple Script and I can't believe in myself I can write this language 😅


dec-06-2559 22-29-18

dec-06-2559 22-32-04

@n3tr
Copy link
Contributor Author

n3tr commented Dec 6, 2016

btw I found an unexpected behavior, if you have 2 windows open and not focus on the window which is running debugging tab. when we run the script, sometime it focuses on wrong window and won't select running tab. It works fine in all case if we're focusing on the debugging window 🙊

It happens in both master and this branch, I have debug the code and nothing wrong with it. maybe it's a bug running Chrome with Apple Script 🍎

@gaearon
Copy link
Contributor

gaearon commented Dec 6, 2016

I think I got it working correctly by the last commit.
(Yea it makes no sense, got this combination by trial and error.)

Can you please test that it works for all cases?

@gaearon gaearon added this to the 0.8.2 milestone Dec 6, 2016
@n3tr
Copy link
Contributor Author

n3tr commented Dec 6, 2016

@gaearon tested, all passes!! 👍

@gaearon gaearon merged commit 6ebec23 into facebook:master Dec 6, 2016
@gaearon
Copy link
Contributor

gaearon commented Dec 6, 2016

Thanks for fixing this!

mofelee added a commit to xiaohu-developer/create-react-app that referenced this pull request Dec 7, 2016
* master: (30 commits)
  Relax peerDependencies for ESLint preset (facebook#1191)
  Update Webpack to fix source map issues (facebook#1188)
  Update webpack prod config (facebook#1181)
  Chrome 'open tab' reuse an empty tab when possible (facebook#1165)
  Use file-loader for svgs (facebook#1180)
  Fix Babel issues in tests by applying the right transforms (facebook#1179)
  [babel-preset-react-app] Temporary fix missing babel plugins (facebook#1177)
  Add Subresource Integrity support (facebook#1176)
  Remove path module from webpack config on eject. (facebook#1175)
  Don't strip stack traces of evaluated webpack bundles (facebook#1050)
  Add deploy to Firebase CDN on template's README (Closes facebook#374) (facebook#1143)
  Update e2e.sh (facebook#1167)
  Document what npm build does and pushState (facebook#933)
  Fix minor typo/grammar (facebook#1099)
  Add "npm run build silently fails" to Troubleshooting (facebook#1168)
  Add testURL to jest config (facebook#1120)
  Make jsx-no-undef rule an error (facebook#1159)
  Update CHANGELOG.md
  Publish
  Update changelog for 0.8.1
  ...
alexdriaguine pushed a commit to alexdriaguine/create-react-app that referenced this pull request Jan 23, 2017
* Reuse empty tab on open chrome apple script

* Break find tab into function

* Use property to store found

* Fix minor issues that caused window to not get active
randycoulman pushed a commit to CodingZeal/create-react-app that referenced this pull request May 8, 2017
* Reuse empty tab on open chrome apple script

* Break find tab into function

* Use property to store found

* Fix minor issues that caused window to not get active
@lock lock bot locked and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chrome "open tab" script should reuse an empty tab
3 participants