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

Maximum call stack size exceeded #104

Open
srgg opened this issue Oct 10, 2022 · 1 comment
Open

Maximum call stack size exceeded #104

srgg opened this issue Oct 10, 2022 · 1 comment

Comments

@srgg
Copy link

srgg commented Oct 10, 2022

I've tried to use a basic example, then switch to FC approach, but simple graph app still fails.

Here is a code:

import React, {useRef, useCallback, FC} from 'react';
import CytoscapeComponent from 'react-cytoscapejs';
import type cytoscape from 'cytoscape';


export const СytoscapeGraph: FC = () => {
    const cy = useRef<cytoscape.Core | null>(null);
    const setCytoscape = useCallback(
        (ref: cytoscape.Core) => {
            cy.current = ref;
        },
        [cy],
    );
    const data = {
        nodes: [
            { data: { id: 'one', label: 'Node 1' }, position: { x: 0, y: 0 } },
            { data: { id: 'two', label: 'Node 2' }, position: { x: 100, y: 0 } }
        ],
        edges: [
            {
                data: { source: 'one', target: 'two', label: 'Edge from Node1 to Node2' }
            }
        ]
    }

    const elements = CytoscapeComponent.normalizeElements(data);

    return (
        <CytoscapeComponent
            cy={setCytoscape}
            elements={elements}
        />
    );
}

export default СytoscapeGraph;

And I've got:
image

@bgenia
Copy link

bgenia commented Nov 20, 2023

Had this issue after migrating from webpack 4 to 5.
Turned out it was caused by this webpack setting:

{
  resolve: {
    modules: ['node_modules', 'src']
  }
}

Fixed by removing the setting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants