-
Notifications
You must be signed in to change notification settings - Fork 268
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
Graphin doesn't work with global state library Jotai #449
Comments
Seems like useEffect is causing problem In the following code, Without export default function App() {
const [layout, setLayout] = useState('random')
useEffect(() => {
console.log('New Layout: ', layout)
}, [layout])
return (
<div className="App">
<Graphin data={data} layout={{ type: layout }}>
<ZoomCanvas disabled />
<LayoutSelector setLayout={setLayout} />
</Graphin>
</div>
);
} |
Has someone been able to test it? |
This issue is related to this discussion: #415 |
This can be an issue with React Strict mode. The graph is not rendered properly in strict mode. Note that in strict mode, components are rendered twice. Ref: https://stackoverflow.com/questions/61254372/my-react-component-is-rendering-twice-because-of-strict-mode You may try to disable strict mode and see if the error disappears. |
Describe the bug
Using global state library such as Jotai or Zustend causes the following error:
However, using
useState
works as expected.Full code below:
Your Example Website or App
https://codesandbox.io/s/graphin-jotai-g2n4je?file=/src/App.tsx
Expected behavior
Graphin should work with Jotai
The text was updated successfully, but these errors were encountered: