DomParfitt / graphviz-react

React component for displaying Graphviz graphs
MIT License
103 stars 21 forks source link

Invalid hook call `useMemo` #80

Closed mikeguo99 closed 2 years ago

mikeguo99 commented 2 years ago

the version 1.2.1 has no this problem, however after upgrading to 1.2.2, 1.2.3, or 1.2.4, the problem occurs.

image
DomParfitt commented 2 years ago

Hi @atmikeguo, thanks for raising this.

I believe this is an issue because we're bundling react as a dependency when we shouldn't be (it should be a peer dependency). This is an oversight that's existed since day 1 but is only causing issues since we switched to a functional component using hooks.

I should be able to get a fix out later today but in the meantime I'd suggest pinning to an earlier version as a workaround.

It would probably be worth adding some kind of testing around this to ensure releases haven't regressed.

DomParfitt commented 2 years ago

@atmikeguo This should be fixed in v1.2.5