Coder Social home page Coder Social logo

gojs-react's People

Contributors

dependabot[bot] avatar jonchardy avatar simonsarris avatar walternorthwoods avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gojs-react's Issues

ReactDiagram update with new links passed from props but ignores change of nodes

When I pass new props.project.nodes array, it gets ignored - however new link in props.project.edgescorrectly displays. Is there anything I could be doing wrong?
Both values are obtained through the same GraphQL query.

// Diagram usage

export function ProjectDiagram(props: GetProject) {
  return (
    <div>
      <ReactDiagram
        skipsDiagramUpdate={false}
        initDiagram={initDiagram}
        divClassName="diagram-component"
        nodeDataArray={props.project.nodes.map((node) => ({
          key: node.uniqueName,
          text: node.uniqueName,
        }))}
        linkDataArray={props.project.edges.map((edge) => ({
          key: edge.id,
          from: edge.sourceNodeId,
          to: edge.targetNodeId,
        }))}
        onModelChange={handleModelChange}
      />
    </div>
  );
}
// GraphQL query which's results are in props

export const GET_PROJECT = gql`
  query GetProject($id: String!) {
    project(id: $id) {
      id
      name
      createdAt
      edges {
        id
        sourceNodeId
        targetNodeId
      }
      nodes {
        uniqueName
      }
      users {
        id
        role
      }
    }
  }
`;

Diagram scrollMargin parameter bug

Hi! I think I found a bug in gojs-react.
Im trying to run my gojs app using React and Electron. During my rewrite I noticed that scrollMargin parameter in 'go.Diagram' was causing the following errors:

go.js:773 Uncaught TypeError: this.Yq is not a function
    at Q.set (go.js:773)
    at zj (go.js:651)
    at Ll (go.js:929)
    at Jl (go.js:924)
    at Object.initDiagram (DiagramWrapper.tsx:70)
    at ReactDiagram../node_modules/gojs-react/lib/esm/gojsreact.js.ReactDiagram.componentDidMount (gojsreact.js:23)
    at commitLifeCycles (react-dom.development.js:22101)
    at commitLayoutEffects (react-dom.development.js:25344)
    at HTMLUnknownElement.callCallback (react-dom.development.js:336)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:385)

and

react-dom.development.js:12212 Uncaught TypeError: this.Yq is not a function
    at Q.set (go.js:773)
    at zj (go.js:651)
    at Ll (go.js:929)
    at Jl (go.js:924)
    at Object.initDiagram (DiagramWrapper.tsx:70)
    at ReactDiagram../node_modules/gojs-react/lib/esm/gojsreact.js.ReactDiagram.componentDidMount (gojsreact.js:23)
    at commitLifeCycles (react-dom.development.js:22101)
    at commitLayoutEffects (react-dom.development.js:25344)
    at HTMLUnknownElement.callCallback (react-dom.development.js:336)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:385)

And NOTHING shows on the screen. Even stuff unrelated to GoJS.
It's something about this 'Yq' function. I haven't looked into it deeper. Here's my code for reference:

  • Not working:
const diagram =
      $(go.Diagram,
        {
            scrollMargin: 2000,
            [other params]
        });

  • Working:
const diagram =
      $(go.Diagram,
        {
            [other params]
        });

FIX
For anyone having this problem: only removing this parameter worked for me so that's I guess what you have to do until it's fixed if you want your app to show anything.

If anyone knows a workaround without tradeoffs please share.

question

你好,这个怎么运行呢

Trying to set undefined property "mode" on object: Diagram

os: linux ubuntu 16.04
node: 15.0.1
gojs: 2.1.31
gojs-react: 1.0.10
react: 17.0.1
webpack: 5.10.0

Trying to start following this project README but getting such error. After removing it, gojs start to complain that GraphLinksModel.linkKeyProperty must be not empty string.

Using modelData from https://gojs.net/latest/samples/flowchart.html

Debugging shows that passing modelData, nodeDataArray and linkDataArray to component not helping at all, linkKeyPropety is empty string same as dataArray.

Updating state with different nodeDataArray does not recompute group

Setting a new NodeDataArray with different group create issue.

Ex array :

[{
   key:1
   name:"child",
   category:"child",
   group:2
},
{
   key:2
   name:"group",
   isGroup:true
   category:"group"
}]

Then we use setState with :

[{
   key:1
   name:"child",
   category:"child",
},
{
   key:2
   name:"group",
   isGroup:true
   category:"group"
}]

And the node "child" will still be inside the group.
It seems like those lines are missing from gojs-react :

diagram.startTransaction(); diagram.updateAllRelationshipsFromData(); diagram.updateAllTargetBindings(); diagram.commitTransaction("update");

onModelChange not triggered unless UndoManager.isEnabled

Hi.

I have a few different diagrams (Layered, Force, Radial, Sankey, etc) and I wanted to migrate from react-gojs to your official version. First thing I notice it is new addition of the toIncrementalData, this method is called in the onModelChange. So far so good, until we want to disable undoManager. Then onModelChange it is not triggered anymore.

https://codesandbox.io/s/interesting-gauss-9pofo

In that url you could find a modification of your example(https://github.com/NorthwoodsSoftware/gojs-react-basic). The only 2 things I modified from the original it is:
Added console.log in the handleModelChange in App.tsx
Changed "undoManager.isEnabled": false in Diagram.tsx

What I detected is in const dataChanges = e.model!.toIncrementalData(e); in Diagram file it is always null with this options to false, meanwhile if you put to true is working as expected.

I report it as issues because I expected this is called no matter if undoManager is or not enable, but maybe I missing something.

Regards.

Cant initialise Reactpalatte

I am converting the javascript palette code to reactjs but cant able to pass "myDiagram" object from initDiagram to initPalette. Please provide a way to do it

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.