reaviz / reagraph

🕸 WebGL Graph Visualizations for React. Maintained by @goodcodeus.

Home Page:https://reagraph.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Edge labels not visible in nextjs production build

kanitsharma opened this issue · comments

Describe the bug

Edge labels not visible in nextjs production build.

Screenshot 2022-11-03 at 3 49 30 PM

No errors in console.

It is present in component tree, checked in react devtools.

Screenshot 2022-11-03 at 3 51 20 PM

Working properly in development server.

Screenshot 2022-11-03 at 3 52 27 PM

Tested on chrome and firefox with reagraph@4.7.0

Steps to Reproduce the Bug or Issue

  1. yarn create next-app reagraph-edgelabel-issue
  2. yarn add reagraph
  3. Usage
import dynamic from "next/dynamic";

const GraphCanvas = dynamic(
  import("reagraph").then((mod) => mod.GraphCanvas),
  { ssr: false }
);

export default function Test() {
  return (
    <GraphCanvas
      labelType="all"
      nodes={[
        {
          id: "n-1",
          label: "1",
        },
        {
          id: "n-2",
          label: "2",
        },
      ]}
      edges={[
        {
          id: "1->2",
          source: "n-1",
          target: "n-2",
          label: "Edge 1-2",
        },
      ]}
    />
  );
}
  1. yarn build and yarn start

Expected behavior

Edge labels should be visible.

Screenshots or Videos

No response

Platform

  • Reagraph Version: 4.7.0
  • OS: macOS
  • Browser: Chrome, Firefox
  • NodeJS version: 16.17.1

Your Example Website or App

No response

Additional context

No response

same

commented

@infosechoudini / @kanitsharma - Any chance you could make me an example repo? I'm not super familiar with Next.

@amcdnl @infosechoudini It seems to be fixed in reagraph v4.11.1 and next v13.4.12. Its been a while but If I remember correctly this issue was specific to v4.7.0. In my case I reverted back to v4.5.0 and it was working fine, if that helps.

I observe this issue in a project built with Vite 4, React 18 and Reagraph 4.14.1, Setting reagraph to older versions has no effect. Does anyone know what might be the cause for this? I see that a newly created nextjs 14 project does work fine.

I created an example project to reproduce this issue: https://github.com/hechtjo/reagraph-test
Starting a local dev environment or producing a production build does not make a difference in this case.

Edit: It works now, for some reason labelType='all' has to be specified in this case for the edge-labels to be shown.

NextJS should now not error.