[Bug]: If the node type is "image", createEdge will give an error while creating. #6754
RackweLLizm posted onGitHub
Describe the bug / 问题描述
<html> <body> <!--StartFragment--><div class="console-message" style="box-sizing: border-box; min-width: 0px; min-height: 17px; clear: right; position: relative; padding: 3px 22px 1px 0px; margin-left: 24px; flex: 1 1 auto; display: flex; color: rgb(23, 29, 30); font-family: monospace; font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(252, 235, 235); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><div class="console-message-stack-trace-toggle" style="box-sizing: border-box; min-width: 0px; min-height: 0px; flex: 1 1 auto; display: flex; flex-direction: row; align-items: flex-start; margin-top: -1px;"><div class="console-message-stack-trace-wrapper" aria-label="rect.ts:72 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'src') at ImagePool2.getImageSync (rect.ts:72:51) at Canvas3.handleMounted2 (star.ts:39:19) at EventService2.notifyListeners (arc-2-cubic.ts:1037:25) at EventService2.notifyTarget (arc-2-cubic.ts:1007:10) at EventService2.propagate (arc-2-cubic.ts:682:12) at EventService2.dispatchEvent (arc-2-cubic.ts:641:12) at Image3.dispatchEvent (is-curve-array.ts:139:17) at Canvas3.mountChildren (animation.ts:674:19) at animation.ts:691:12 at Array.forEach (<anonymous>) Stack table expanded" style="box-sizing: border-box; min-width: 0px; min-height: 0px; --override-display-stack-preview-toggle-link: none; flex: 1 1 auto; display: flex; flex-direction: column; align-items: stretch;"><div aria-expanded="true" tabindex="-1" style="box-sizing: border-box; min-width: 0px; min-height: 0px; outline-width: 0px; flex: 0 0 auto;"><span class="source-code" style="box-sizing: border-box; min-width: 0px; min-height: 0px; font-family: var(--source-code-font-family); white-space: pre-wrap; font-size: var(--source-code-font-size) !important; line-height: 1.2;"><span class="console-message-anchor" style="box-sizing: border-box; min-width: 0px; min-height: 0px; float: right; text-align: right; max-width: 100%; margin-left: 4px;"><button class="devtools-link text-button link-style" jslog="Link; context: script-location; track: click" role="link" tabindex="-1" title="http://localhost/node_modules/@antv/g6/esm/elements/nodes/elements/nodes/rect.ts:72" style="box-sizing: border-box; min-width: 0px; min-height: 0px; font: inherit; margin: 0px; height: unset; border: none; border-radius: 2px; padding: 0px !important; color: var(--sys-color-primary); background: none; flex: 0 0 auto; white-space: nowrap; text-decoration: underline; outline-offset: 2px; outline: none; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; word-break: break-all;"><br class="Apple-interchange-newline">rect.ts:72</button> </span><span class="console-message-text" style="box-sizing: border-box; min-width: 0px; min-height: 0px; color: var(--override-error-text-color) !important;">Uncaught (in promise) <span class="object-value-error source-code" style="box-sizing: border-box; min-width: 0px; min-height: 0px; font-family: var(--source-code-font-family); white-space: pre-wrap; font-size: var(--source-code-font-size) !important; line-height: 1.2;"><span style="box-sizing: border-box; min-width: 0px; min-height: 0px;">TypeError: Cannot read properties of undefined (reading 'src') <span class="formatted-stack-frame" style="box-sizing: border-box; min-width: 0px; min-height: 0px;"> at ImagePool2.getImageSync (<button class="devtools-link text-button link-style" jslog="Link; context: script-location; track: click" role="link" tabindex="-1" title="http://localhost/node_modules/@antv/g6/esm/elements/nodes/elements/nodes/rect.ts:72:51" style="box-sizing: border-box; min-width: 0px; min-height: 0px; font: inherit; margin: 0px; height: unset; border: none; border-radius: 2px; padding: 0px !important; color: var(--sys-color-primary); background: none; flex: 0 0 auto; white-space: nowrap; text-decoration: underline; outline-offset: 2px; outline: none; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; word-break: break-all;">rect.ts:72:51</button>) </span><span class="formatted-stack-frame" style="box-sizing: border-box; min-width: 0px; min-height: 0px;"> at Canvas3.handleMounted2 (<button class="devtools-link text-button link-style" jslog="Link; context: script-location; track: click" role="link" tabindex="-1" title="http://localhost/node_modules/@antv/g6/esm/elements/nodes/elements/nodes/star.ts:39:19" style="box-sizing: border-box; min-width: 0px; min-height: 0px; font: inherit; margin: 0px; height: unset; border: none; border-radius: 2px; padding: 0px !important; color: var(--sys-color-primary); background: none; flex: 0 0 auto; white-space: nowrap; text-decoration: underline; outline-offset: 2px; outline: none; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; word-break: break-all;">star.ts:39:19</button>) </span><span class="formatted-stack-frame" style="box-sizing: border-box; min-width: 0px; min-height: 0px;"> at EventService2.notifyListeners (<button class="devtools-link text-button link-style" jslog="Link; context: script-location; track: click" role="link" tabindex="-1" title="http://localhost/node_modules/@antv/util/esm/path/process/path/process/arc-2-cubic.ts:1037:25" style="box-sizing: border-box; min-width: 0px; min-height: 0px; font: inherit; margin: 0px; height: unset; border: none; border-radius: 2px; padding: 0px !important; color: var(--sys-color-primary); background: none; flex: 0 0 auto; white-space: nowrap; text-decoration: underline; outline-offset: 2px; outline: none; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; word-break: break-all;">arc-2-cubic.ts:1037:25</button>) </span><span class="formatted-stack-frame" style="box-sizing: border-box; min-width: 0px; min-height: 0px;"> at EventService2.notifyTarget (<button class="devtools-link text-button link-style" jslog="Link; context: script-location; track: click" role="link" tabindex="-1" title="http://localhost/node_modules/@antv/util/esm/path/process/path/process/arc-2-cubic.ts:1007:10" style="box-sizing: border-box; min-width: 0px; min-height: 0px; font: inherit; margin: 0px; height: unset; border: none; border-radius: 2px; padding: 0px !important; color: var(--sys-color-primary); background: none; flex: 0 0 auto; white-space: nowrap; text-decoration: underline; outline-offset: 2px; outline: none; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; word-break: break-all;">arc-2-cubic.ts:1007:10</button>) </span><span class="formatted-stack-frame" style="box-sizing: border-box; min-width: 0px; min-height: 0px;"> at EventService2.propagate (<button class="devtools-link text-button link-style" jslog="Link; context: script-location; track: click" role="link" tabindex="-1" title="http://localhost/node_modules/@antv/util/esm/path/process/path/process/arc-2-cubic.ts:682:12" style="box-sizing: border-box; min-width: 0px; min-height: 0px; font: inherit; margin: 0px; height: unset; border: none; border-radius: 2px; padding: 0px !important; color: var(--sys-color-primary); background: none; flex: 0 0 auto; white-space: nowrap; text-decoration: underline; outline-offset: 2px; outline: none; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; word-break: break-all;">arc-2-cubic.ts:682:12</button>) </span><span class="formatted-stack-frame" style="box-sizing: border-box; min-width: 0px; min-height: 0px;"> at EventService2.dispatchEvent (<button class="devtools-link text-button link-style" jslog="Link; context: script-location; track: click" role="link" tabindex="-1" title="http://localhost/node_modules/@antv/util/esm/path/process/path/process/arc-2-cubic.ts:641:12" style="box-sizing: border-box; min-width: 0px; min-height: 0px; font: inherit; margin: 0px; height: unset; border: none; border-radius: 2px; padding: 0px !important; color: var(--sys-color-primary); background: none; flex: 0 0 auto; white-space: nowrap; text-decoration: underline; outline-offset: 2px; outline: none; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; word-break: break-all;">arc-2-cubic.ts:641:12</button>) </span><span class="formatted-stack-frame" style="box-sizing: border-box; min-width: 0px; min-height: 0px;"> at Image3.dispatchEvent (<button class="devtools-link text-button link-style" jslog="Link; context: script-location; track: click" role="link" tabindex="-1" title="http://localhost/node_modules/@antv/util/esm/path/util/path/util/is-curve-array.ts:139:17" style="box-sizing: border-box; min-width: 0px; min-height: 0px; font: inherit; margin: 0px; height: unset; border: none; border-radius: 2px; padding: 0px !important; color: var(--sys-color-primary); background: none; flex: 0 0 auto; white-space: nowrap; text-decoration: underline; outline-offset: 2px; outline: none; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; word-break: break-all;">is-curve-array.ts:139:17</button>) </span><span class="formatted-stack-frame" style="box-sizing: border-box; min-width: 0px; min-height: 0px;"> at Canvas3.mountChildren (<button class="devtools-link text-button link-style" jslog="Link; context: script-location; track: click" role="link" tabindex="-1" title="http://localhost/node_modules/@antv/g6/esm/constants/constants/animation.ts:674:19" style="box-sizing: border-box; min-width: 0px; min-height: 0px; font: inherit; margin: 0px; height: unset; border: none; border-radius: 2px; padding: 0px !important; color: var(--sys-color-primary); background: none; flex: 0 0 auto; white-space: nowrap; text-decoration: underline; outline-offset: 2px; outline: none; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; word-break: break-all;">animation.ts:674:19</button>) </span><span class="formatted-stack-frame" style="box-sizing: border-box; min-width: 0px; min-height: 0px;"> at <button class="devtools-link text-button link-style" jslog="Link; context: script-location; track: click" role="link" tabindex="-1" title="http://localhost/node_modules/@antv/g6/esm/constants/constants/animation.ts:691:12" style="box-sizing: border-box; min-width: 0px; min-height: 0px; font: inherit; margin: 0px; height: unset; border: none; border-radius: 2px; padding: 0px !important; color: var(--sys-color-primary); background: none; flex: 0 0 auto; white-space: nowrap; text-decoration: underline; outline-offset: 2px; outline: none; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; word-break: break-all;">animation.ts:691:12</button> </span> at Array.forEach (<anonymous>)</span></span></span></span></div><div class="" role="group" style="box-sizing: border-box; min-width: 0px; min-height: 0px; flex: 0 0 auto;"><span class="monospace stack-preview-container width-constrained" style="display: inline-block; --monospace-font-size: 12px; --monospace-font-family: monospace; --source-code-font-size: 12px; --source-code-font-family: monospace; width: 781.676px; box-sizing: border-box; min-width: 0px; min-height: 0px; font-family: var(--monospace-font-family); font-size: var(--monospace-font-size) !important;"> | getImageSync | @ | rect.ts:72 -- | -- | -- | -- | handleMounted2 | @ | star.ts:39 | notifyListeners | @ | arc-2-cubic.ts:1037 | notifyTarget | @ | arc-2-cubic.ts:1007 | propagate | @ | arc-2-cubic.ts:682 | dispatchEvent | @ | arc-2-cubic.ts:641 | dispatchEvent | @ | is-curve-array.ts:139 | mountChildren | @ | animation.ts:674 | (anonymous) | @ | animation.ts:691 | mountChildren | @ | animation.ts:690 | appendChild | @ | segment-arc-factory.ts:230 | createElement | @ | element.ts:435 | (anonymous) | @ | element.ts:474 | (anonymous) | @ | element.ts:474 | createElements | @ | element.ts:473 | draw | @ | element.ts:299 | (anonymous) | @ | create-edge.ts:156 | (anonymous) | @ | collapse-expand.ts:71 | __awaiter4 | @ | collapse-expand.ts:71 | handleCreateEdge | @ | create-edge.ts:117 | doEmit | @ | index.ts:69 | EventEmitter3.emit | @ | index.ts:73 | BehaviorController.forwardCanvasEvents | @ | behavior.ts:102 | notifyListeners | @ | arc-2-cubic.ts:1026 | notifyTarget | @ | arc-2-cubic.ts:1007 | propagate | @ | arc-2-cubic.ts:682 | dispatchEvent | @ | arc-2-cubic.ts:641 | EventService2.onPointerUp | @ | arc-2-cubic.ts:335 | mapEvent | @ | arc-2-cubic.ts:210 | (anonymous) | @ | polyline.ts:115 | (anonymous) | @ | torgb.ts:15 | call | @ | torgb.ts:13 | onPointerUp2 | @ | html.ts:30
</body> </html>
Reproduction link / 复现链接
No response
Steps to Reproduce the Bug or Issue / 重现步骤
This error does not prevent the edge from being created. The edge is created, but when it fails, the animation of the edge does not work. In other words, the edge tip is not visible. After the edge is created, the edge becomes visible.
G6 Version / G6 版本
🆕 5.x
OS / 操作系统
- macOS
- Windows
- Linux
- Others / 其他
Browser / 浏览器
- Chrome
- Edge
- Firefox
- Safari (Limited support / 有限支持)
- IE (Nonsupport / 不支持)
- Others / 其他