Osmose / advanced-open-file

Open files and folders in Atom easily.
https://atom.io/packages/advanced-open-file
Other
119 stars 20 forks source link

React Minified Error on activation #116

Open lironess opened 8 years ago

lironess commented 8 years ago

just pressed Cmd+alt+O and got :

Atom Version: 1.7.3 System: Mac OS X 10.11.5 Thrown From: advanced-open-file package, v0.16.2

Stack Trace

Failed to activate the advanced-open-file package

At Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.

Error: Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.
    at invariant (/Users/lironshmuel/.atom/packages/advanced-open-file/node_modules/react/node_modules/fbjs/lib/invariant.js:34:15)
    at Object.ReactOwner.addComponentAsRefTo (/Users/lironshmuel/.atom/packages/advanced-open-file/node_modules/react/lib/ReactOwner.js:67:373)
    at attachRef (/Users/lironshmuel/.atom/packages/advanced-open-file/node_modules/react/lib/ReactRef.js:23:16)
    at Object.ReactRef.attachRefs (/Users/lironshmuel/.atom/packages/advanced-open-file/node_modules/react/lib/ReactRef.js:42:5)
    at ReactDOMComponent.attachRefs (/Users/lironshmuel/.atom/packages/advanced-open-file/node_modules/react/lib/ReactReconciler.js:22:12)
    at CallbackQueue._assign.notifyAll (/Users/lironshmuel/.atom/packages/advanced-open-file/node_modules/react/lib/CallbackQueue.js:66:22)
    at ReactReconcileTransaction.ON_DOM_READY_QUEUEING.close (/Users/lironshmuel/.atom/packages/advanced-open-file/node_modules/react/lib/ReactReconcileTransaction.js:79:26)
    at ReactReconcileTransaction.Mixin.closeAll (/Users/lironshmuel/.atom/packages/advanced-open-file/node_modules/react/lib/Transaction.js:202:25)
    at ReactReconcileTransaction.Mixin.perform (/Users/lironshmuel/.atom/packages/advanced-open-file/node_modules/react/lib/Transaction.js:149:16)
    at batchedMountComponentIntoNode (/Users/lironshmuel/.atom/packages/advanced-open-file/node_modules/react/lib/ReactMount.js:124:15)
    at ReactDefaultBatchingStrategyTransaction.Mixin.perform (/Users/lironshmuel/.atom/packages/advanced-open-file/node_modules/react/lib/Transaction.js:136:20)
    at Object.ReactDefaultBatchingStrategy.batchedUpdates (/Users/lironshmuel/.atom/packages/advanced-open-file/node_modules/react/lib/ReactDefaultBatchingStrategy.js:63:19)
    at Object.batchedUpdates (/Users/lironshmuel/.atom/packages/advanced-open-file/node_modules/react/lib/ReactUpdates.js:97:20)
    at Object.ReactMount._renderNewRootComponent (/Users/lironshmuel/.atom/packages/advanced-open-file/node_modules/react/lib/ReactMount.js:277:18)
    at Object.ReactMount._renderSubtreeIntoContainer (/Users/lironshmuel/.atom/packages/advanced-open-file/node_modules/react/lib/ReactMount.js:354:32)
    at Object.ReactMount.render (/Users/lironshmuel/.atom/packages/advanced-open-file/node_modules/react/lib/ReactMount.js:374:23)
    at new AdvancedOpenFileView (/Users/lironshmuel/.atom/packages/advanced-open-file/lib/view.js:23:33)
    at new AdvancedOpenFileController (/Users/lironshmuel/.atom/packages/advanced-open-file/lib/controller.js:23:21)
    at Object.activate (/Users/lironshmuel/.atom/packages/advanced-open-file/lib/advanced-open-file.js:11:18)
    at Package.module.exports.Package.activateNow (/opt/homebrew-cask/Caskroom/atom/1.7.3/Atom.app/Contents/Resources/app.asar/src/package.js:183:20)
    at /opt/homebrew-cask/Caskroom/atom/1.7.3/Atom.app/Contents/Resources/app.asar/src/package.js:795:25
    at Function.module.exports.Emitter.simpleDispatch (/opt/homebrew-cask/Caskroom/atom/1.7.3/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/opt/homebrew-cask/Caskroom/atom/1.7.3/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:125:28)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/opt/homebrew-cask/Caskroom/atom/1.7.3/Atom.app/Contents/Resources/app.asar/src/command-registry.js:241:20)
    at /opt/homebrew-cask/Caskroom/atom/1.7.3/Atom.app/Contents/Resources/app.asar/src/command-registry.js:3:61
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/opt/homebrew-cask/Caskroom/atom/1.7.3/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:580:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/opt/homebrew-cask/Caskroom/atom/1.7.3/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:388:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/opt/homebrew-cask/Caskroom/atom/1.7.3/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:98:36)
    at HTMLDocument.<anonymous> (/opt/homebrew-cask/Caskroom/atom/1.7.3/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:3:61)

Commands

     -0:19.6.0 settings-view:open (atom-text-editor.editor.is-focused)
     -0:00.6.0 advanced-open-file:toggle (atom-text-editor.editor.mini.is-focused)

Config

{
  "core": {
    "disabledPackages": [
      "git-difftool"
    ],
    "themes": [
      "nucleus-dark-ui",
      "atom-dark-fusion-syntax"
    ]
  }
}

Installed Packages

# User
Sublime-Style-Column-Selection, v1.5.1
advanced-open-file, v0.16.2
atom-dark-fusion-syntax, v1.1.0
atom-ternjs, v0.14.1
autocomplete-modules, v1.4.1
hyperclick, v0.0.36
js-hyperclick, v1.4.2
linter, v1.11.4
linter-eslint, v7.2.2
nucleus-dark-ui, v0.7.22
react, v0.15.0

# Dev
No dev packages
Osmose commented 8 years ago

Thanks for the report!

This might be related to #115, I'll see if I can replicate this when I get a chance.

Osmose commented 8 years ago

Hmm, my initial attempts to replicate by installing packages that match those from #115 failed. Do you consistently get this error? If so, are you able to get the error with all your packages except for advanced-open-file disabled? I'd like to see if it's an issue with a specific library being installed.

lironess commented 8 years ago

I'm getting this error only from advanced-open-file package, everything else works fine (and I have a lot of packages ..) Also - I tried to uninstall and install it again, but same error occurs again

hobofan commented 8 years ago

Getting the same error, every time I try to open the open file dialog.

Let me know if you need any further info. Let me also take this chance to say that I love this plugin! :)

For anyone coming along this issue, I was able to downgrade to the last running version via apm install advanced-open-file@0.16.1.

Osmose commented 8 years ago

@hobofan I'm not free tonight, but tomorrow I can try and see if there's a way to make a non-minified build that will show the actual error, and then ask you to run it and see if you still get an error with more useful info than "i hate freedom and won't tell anyone why I'm breaking".

Osmose commented 8 years ago

Here's the real error message:

addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a
component that was not created inside a component's `render` method, or you have multiple copies
of React loaded (details: https://fb.me/react-refs-must-have-owner).
Osmose commented 8 years ago

Given the amount of reports of this problem and my inability to find a solution promptly, I've decided to AGAIN revert the React changes until I can solve this. I've release v0.16.3, which is identical to v0.16.0, the first time I reverted to pre-React advanced-open-file.

@lironess @hobofan Can ya'll confirm if the new version works for you again?

hobofan commented 8 years ago

@Osmose :+1: 0.16.3 works.

Osmose commented 8 years ago

Cool, thanks for verifying!

Also, there's a lot of I in my last comment. I am more than willing to accept help or patches for this problem, I just don't get a whole lot of PRs usually for this project.

I suspect the problem here is, as the error message says, conflicting instances of React. Multiple instances of React in the same page don't play well together. There's react-for-atom which proposes sharing a single React instance among all the plugins, but this approach breaks when packages want to rely on different versions of React.

After some testing, I thought that I found that React can coexist with other instances of itself on a page as long as they don't interact (IE they don't mess with globals and their components never touch each other), but apparently that's not the case.

I'm not really that strong of a frontend developer so I'm not confident in my ability to write a good non-React view for the package that does the clever things the React view changes introduced, but that might be the only solution here.