question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

9.5.4: Server side rendering positioning breaks

See original GitHub issue

When using Gatsby, the transforms of the diagrams will show off position

9.5.3

image

9.5.4

image

Code

import React from "react";
import ReactFlow, {
  ReactFlowProvider,
  addEdge,
  removeElements,
} from "react-flow-renderer";

const items = [
  {
    id: "1",
    data: {
      label: <>Label</>,
    },
    position: { x: 100, y: 0 },
  },
  {
    id: "2",
    data: { label: "Label 2" },
    position: {
      x: 100,
      y: 60,
    },
  },
  { id: "3", data: { label: "Label 3" }, position: { x: 100, y: 120 } },
  { id: "4", data: { label: "Label Four" }, position: { x: 100, y: 180 } },
  { id: "5", data: { label: "Label 5" }, position: { x: 100, y: 240 } },
  {
    id: "e1-2",
    source: "1",
    target: "2",
  },
  { id: "e2-3", source: "2", target: "3" },
  { id: "e3-4", source: "3", target: "4" },
  { id: "e4-5", source: "4", target: "5" },
];

export const ExampleChartFlow: React.FC = () => {
  const [elements, setElements] = React.useState(items);
  const onConnect = (params) => setElements((els) => addEdge(params, els));
  const onElementsRemove = (elementsToRemove) =>
    setElements((els) => removeElements(elementsToRemove, els));

  return (
    <ReactFlowProvider>
      <div className="reactflow-wrapper" style={{ height: "60vh" }}>
        <ReactFlow
          elements={elements}
          onConnect={onConnect}
          onElementsRemove={onElementsRemove}
          nodesDraggable={false}
          paneMoveable={false}
          zoomOnScroll={false}
          zoomOnPinch={false}
          zoomOnDoubleClick={false}
          onLoad={(reactFlowInstance) => {
            reactFlowInstance.fitView();
          }}
          snapToGrid={true}
          snapGrid={[15, 15]}
        />
      </div>
    </ReactFlowProvider>
  );
};

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tonycommented, Jun 5, 2021

@moklick Works for me too! (Tested with 9.6.0)

1reaction
Redirtscommented, May 28, 2021

Works! 😃 Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Server-side rendering - Apollo GraphQL Docs
Server -side rendering (SSR) is a performance optimization for modern web apps. It enables you to render your app's initial state to raw...
Read more >
NextJS serverside Breakpoints possible? - Stack Overflow
I've got a debugger in my getInitialProps and it never breaks at that point. It only breaks when it's ran on the browser,...
Read more >
Server Side Rendering in React – How it Works - eSketchers
In simple words, client-side rendering is the rendering of content in the browser using JavaScript. The process involves an HTML document, with ...
Read more >
Server rendering - Material UI - MUI
The most common use case for server-side rendering is to handle the initial render when a user (or search engine crawler) first requests...
Read more >
What is server-side rendering and how does it improve site ...
Server -side rendering (SSR) addresses the performance and search engine optimization issues of single-page JavaScript applications.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found