fabien0102 / gatsby-starter

Gatsby 2.0 starter with typescript and many cools dev tools
386 stars 99 forks source link

Javascript error when dragging splitter in storybook #37

Closed svdoever closed 6 years ago

svdoever commented 6 years ago

storybook issue draging splitpane

fabien0102 commented 6 years ago

@svdoever Closed by #36 or it's something else?

svdoever commented 6 years ago

@fabien0102 no is something else... tried to solve it, but can't find it. Is resizing the splitter working for you? Tried also to disable right side and getting it to botom using:

setOptions({
  name: 'My website',
  downPanelInRight: false
});

but did not help.

fabien0102 commented 6 years ago

Ok, I got the bug at home, very strange! I'm trying to debug fix this in the morning :wink:

fabien0102 commented 6 years ago

So, apparently, it's a problem with ReactDOM.findDOMNode() in SplitPane… Very very strange 😕

https://github.com/tomkp/react-split-pane/blob/master/src/SplitPane.js#L100 https://reactjs.org/docs/react-dom.html#finddomnode

svdoever commented 6 years ago

I tried to debug it myself as well, but could not solve it. Tried to update to latest version of react-split-pane, but both npm and yarn messed up the whole installation...

fabien0102 commented 6 years ago

I have updated storybook and storybook-addons too, nothing happens ^^ I have tried react-split-pane alone in the last CRA (so with react 16) it works! Very very weird…

svdoever commented 6 years ago

What is CRA?

fabien0102 commented 6 years ago

Create React App -> https://github.com/facebookincubator/create-react-app (official boileplate for react ;) )

svdoever commented 6 years ago

Haha, all those acronyms... - use it all the time:-) Your Gatsby template is the only project where I can reproduce this issue, works in all other situations:-(

fabien0102 commented 6 years ago

I tried to remove everything (typescript, webpack.config, addons, stories) So just a basic example with a helloword story in javascript, always the same issue ^^ I'm trying to remove yarn.lock and node_module, after that, I don't have more idea!

fabien0102 commented 6 years ago

😢 After a total reinstall of my node_modules without any yarn.lock, same result… Very very strange…

fabien0102 commented 6 years ago

Always the same issue after a getstorybook! My god!

fabien0102 commented 6 years ago

I got something!

Reproduction steps:

So something happens between storybook and gatsby dependencies… But what!? ^^

fabien0102 commented 6 years ago

storybook-panel

So, that seams to be a yarn issue, it's working perfectly with npm i on create-react-app. But obviously, I got manyyyyyyy other errors with storybook (with npm on this starter)

fabien0102 commented 6 years ago

Ok now all is working, it was just double types declaration.

Dirty fix:

$ rimraf node_modules/\@types/react-test-renderer/node_modules
$ rimraf node_modules/\@types/react-dom/node_modules

@svdoever Do you an idea to fix this kind of issue? Or I just add a basic post-install script to have a dirty fix…

svdoever commented 6 years ago

In the tsconfig in the "paths" node it should be possible to specify which type definition files should have precendence in case of double type declarations, i.e.

{
    "compilerOptions": {
        "baseUrl": ".",
        "outDir": "./dist/",
        "sourceMap": true,
        "noImplicitAny": true,
        "allowSyntheticDefaultImports": true,
        "module": "commonjs",
        "target": "esnext",
        "jsx": "react",
        "lib": ["dom", "esnext"],
        "types": [
            "webpack-env",
            "node"
        ],
        "typeRoots": [
            "./types",
            "node_modules/@types",
            "node_modules"
        ],
        "paths": { 
            "react": ["./node_modules/@types/react"],
            "*": ["./types/*", "*"]
        }
    },
    "include": [
        "./src/**/*"
    ]
}

maybe it is possible to solve this issue tht way?

fabien0102 commented 6 years ago

Finally, I had just updgrade local types version for react, so no more double dependencies ;) But thanks for you tips, I keep this in mind for the next time it happens ^^

svdoever commented 6 years ago

@fabien0102 when I install a fresh version of the GitHub repo I still get the splitter error... what should I do to solve the issue? Could you include the solution in the "fresh install"?

fabien0102 commented 6 years ago

I’ve never merged my PR, I will try to do this today ;) But try with npm instead yarn, it’s a dependencies conflict issue ;)

fabien0102 commented 6 years ago

@svdoever Normally it's ok with #38

Can you do a fresh install with npm and confirm that all are working for you? (I will close this issue after your confirmation 😉 )

svdoever commented 6 years ago

Did gatsby new gatsby-starter-prestine2 https://github.com/fabien0102/gatsby-starter, same issue. Then rimraf node_modules and npm install: issue fixed. Then rimraf node_modules and yarn: problem is back.

Does gatsby new use yarn for install?