Giter VIP home page Giter VIP logo

Comments (9)

ysds avatar ysds commented on September 16, 2024 2

Dynamically instantiated SVG elements don't work: https://issues.chromium.org/issues/40656725
svg may needs an appropriate namespace.


It is worth trying this:

- <svg className="react-flow__marker"> 
+ <svg xmlns="http://www.w3.org/2000/svg" className="react-flow__marker">

There seem to be other svg's in the codebase with no namespace defined.

from react-flow.

ysds avatar ysds commented on September 16, 2024 1

I found a workaround. This works fine in Chrome:
https://codesandbox.io/p/sandbox/focused-morse-8wm7s5

Add a custom edge marker, and set it in thedefaultEdgeOptions:

<svg style={{ position: `absolute`, width: 0, height: 0 }}>
  <defs>
    <marker
      id="default-edge-marker"
      viewBox="0 0 0 0"
      markerHeight={0}
      markerWidth={0}
    ></marker>
  </defs>
</svg>
<ReactFlow
  defaultEdgeOptions={{
    markerStart: `default-edge-marker`,
    markerEnd: `default-edge-marker`,
  }}
/>

from react-flow.

bcakmakoglu avatar bcakmakoglu commented on September 16, 2024

Don't mutate objects in your setter function, that's where the issue comes from.
Replace this

if (edge.id === "e1-2") {
  edge.markerStart = markerStart;
}

with this

if (edge.id === "e1-2") {
  return {
    ...edge,
    markerStart,
  };
}

Here's your sandbox corrected.

from react-flow.

ysds avatar ysds commented on September 16, 2024

Thanks, but that Sandbox still doesn't seem to work correctly.

  1. Go to the https://codesandbox.io/p/sandbox/misty-wave-6yl8t3?file=%2FApp.js%3A31%2C9-36%2C10 (should reload the page)
  2. Click the "Arrow" checkbox
  3. Marker is not rendered

from react-flow.

bcakmakoglu avatar bcakmakoglu commented on September 16, 2024

The sandbox I linked seems to work completely fine. I open the sandbox, click the checkbox and see a red marker appearing without having to click/drag or do anything at all.

Even the one you linked works completely fine 😄

from react-flow.

ysds avatar ysds commented on September 16, 2024

Is it possible that this is environmentally dependent? I am having problems in my environment described in the ticket.

2024-05-21.20.28.41.mov

from react-flow.

bcakmakoglu avatar bcakmakoglu commented on September 16, 2024

Mh... what browser is that? Chrome?

from react-flow.

bcakmakoglu avatar bcakmakoglu commented on September 16, 2024

Interesting, in Chrome it doesn't work but in FF it does 😄
Seems to be a bug somewhere, that's strange

from react-flow.

peterkogo avatar peterkogo commented on September 16, 2024

Interesting find!

from react-flow.

Related Issues (20)

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.