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

Module does not work in react #22

Closed
OR13 opened this issue Jan 29, 2022 · 9 comments
Closed

Module does not work in react #22

OR13 opened this issue Jan 29, 2022 · 9 comments
Labels
bug Something isn't working

Comments

@OR13
Copy link

OR13 commented Jan 29, 2022

Describe the Bug

installing latest versions and trying the example in the readme leads to

AutoLayout.js:15 Uncaught (in promise) TypeError: BpmnModdle is not a constructor

its caused by:

function AutoLayout() {
  this.moddle = new BpmnModdle(); // the import for this not right / default export needs to be updated 
  this.DiFactory = new DiFactory(this.moddle);
  this.nodeCount = -1;
}

Steps to Reproduce

See above.

Expected Behavior

Expect the layout to work with the latest versions of bpmn-moddle.

Environment

  • Host (Browser/Node version), if applicable: Tested in node... it sorta works... tested in the browser it does not work
  • OS: macOS
  • Library version:
   "bpmn-auto-layout": "^0.1.0",
    "bpmn-engine": "^13.0.0",
    "bpmn-js": "^8.9.0",
    "bpmn-moddle": "^7.1.2",
@OR13 OR13 added the bug Something isn't working label Jan 29, 2022
@OR13
Copy link
Author

OR13 commented Jan 29, 2022

Is there a recommended alternative to this library that is maintained?

@philippfromme
Copy link

There is no alternative solution that is maintained by the bpmn.io team, sorry. 😢

@pinussilvestrus pinussilvestrus added the backlog Queued in backlog label Feb 7, 2022
@OR13
Copy link
Author

OR13 commented Sep 13, 2022

@ermarkar You pretty much need to use other software to fix the layout manually... see also process-analytics/bpmn-visualization-js#1837

@goto-loop
Copy link

I'm having the same issue with the latest version and was able to fix it with the changes in https://github.com/bpmn-io/bpmn-auto-layout/pull/31/files.

@corocoto You've decided to close the pull request, but I don't quite understand why. Were you able to solve the issue in a different way?

@corocoto
Copy link
Contributor

corocoto commented Mar 31, 2023

@goto-loop, yes, you are right that the solution resolves this problem.

I think we want to settle on a library target (is this ES or CJS modules), clean this up, and potentially provide a pre-built distribution for it (that works independent of the usage context).

#31 (comment)

But as I understood @nikku, we should rewrite all the codebase to a specific format (as example, to the es modules syntax) that will work in both environments. But didn't create specific wrappers and conditions upon the current solution (as I did with bpmn-moddle in that PR).

And if we should follow this approach, then my PR wasn't relevant. Because the problem lies in other things, and that fix is only a consequence of it.

But I can reopen PR if I misunderstood @nikku. It's not a problem.

P.S. @nikku, would you like to join the discussion and share your vision?

@goto-loop
Copy link

I agree that rewriting all code using a consistent style would be nicer than fixing things here and there. However, with the project not being officially maintained, it seems unlikely that this will happen in the near future. So in my opinion it would make sense to fix these kind of "breaking" issues.

Just for context: In order to use the package with React at all, you need to clone it, modify the code, build it and then install from your local copy. It's so much effort for a problem that you, @corocoto, have already solved.

@nikku It would be great to hear your opinion on this.

@corocoto
Copy link
Contributor

corocoto commented Apr 3, 2023

@goto-loop, I like your view on this situation and agree with it. Reopened the PR.

@OR13
Copy link
Author

OR13 commented May 15, 2023

auto layout is really useful if you are compiling to BPMN from another data source.

@nikku
Copy link
Member

nikku commented May 22, 2023

Should start to work with #33 being merged.

@nikku nikku closed this as completed May 22, 2023
@bpmn-io-tasks bpmn-io-tasks bot removed the backlog Queued in backlog label May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

6 participants