reaviz / reaflow

🎯 React library for building workflow editors, flow charts and diagrams. Maintained by @goodcodeus.
https://reaflow.dev
Apache License 2.0
2.07k stars 120 forks source link

Error getting started #91

Open edewit opened 3 years ago

edewit commented 3 years ago

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Other... Please describe:

Current behavior

Just added reaflow to my project and I get the following error in the console:

          <Canvas
            nodes={[
              {
                id: "1",
                text: "1",
              },
              {
                id: "2",
              },
              {
                id: "2-1-1",
                text: "2 > 2.1",
                parent: "2",
              },
              {
                id: "3",
                text: "3",
              },
            ]}
            edges={[
              {
                id: "1-2",
                from: "1",
                to: "2",
              },
              {
                id: "2-3",
                from: "2",
                to: "3",
              },
            ]}
          />
VM21084 react_devtools_backend.js:2560 Layout Error: ReferenceError: g is not defined
    at Emd (reaflow.js:19015)
    at Iqd (reaflow.js:19663)
    at h.dispatch (reaflow.js:19962)
    at h.saveDispatch (reaflow.js:19962)
    at reaflow.js:19963

Expected behavior

Seeing my simple diagram

Environment


Libs:
- "react": "^16.14.0",
- "reaflow": "^3.1.3",


Browser:
- [X] Chrome (desktop) version 91.0.4472.114 (Official Build) (64-bit)
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX

For Tooling issues:
- Node version: v16.0.0  
- Platform:  Linux

Others:

amcdnl commented 3 years ago

Thanks for reporting. I've not seen this before and I use the library everyday. Could you make a simple github repo w/ the issue ( that will also help others getting started too! ).

edewit commented 3 years ago

@amcdnl it might be due to the fact I use snowpack, here is a repo to reproduce this issue

amcdnl commented 3 years ago

Ah - snowpack. I would bet thats it. I'm not very familiar with snowpack but I can take a look.

joycollector commented 3 years ago

Sam issue here using Vite2 (using esbuild same as in snowpack).

edewit commented 3 years ago

@joycollector right I think snowpack uses that as well

amcdnl commented 3 years ago

Anyone have any experience w/ snowpack that could shed some light? I poked around and I think its because elkjs runs in a webworker and thus the issue.

leonbloy commented 2 years ago

Same here with vite2

Seems to me related to https://github.com/kieler/elkjs/issues/127

diegonunes4 commented 2 years ago

Hello is there a fix for this? I went to elkjs page and they say it gets solved on their new version, is it possible to bump to most recent version?

SharonGrossman commented 2 years ago

Hey there, it seems like bumping elkjs solves this issue, and this is still reproducing as of today, so can we get a bump to the newest version please? I can submit a PR if it's relevant

Edit: PR opened https://github.com/reaviz/reaflow/pull/181

amcdnl commented 2 years ago

@SharonGrossman - Merged and released!