0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

cytoscapeでmouseover時に発生するUncaught TypeError: Cannot read properties of null (reading 'isHeadless')のエラーを回避したメモ

Last updated at Posted at 2025-11-09

概要

下記エラーが出る現象に悩まされていた。

cytoscape-DbdlAXfE.js:4 Uncaught TypeError: Cannot read properties of null (reading 'isHeadless')

エラーについて

何故かthis.rendereがnullになっている。
e.registerBinding([t, D], mousemove, function(t) {のように、mouseoverイベントで出るものだから真っ赤。
image.png
image.png

対策

原因が追いきれなかったが、オプションにlayoutを渡すと発生する模様。
暫定的に下記のようにすると回避できることが分かった

    const defaultLayout = {
      name: 'cose',
      padding: 50,
    };
    const cy = cytoscape({
      container: containerRef.current,
      elements: { nodes, edges },
-      layout: defaultLayout,
      style: cytoscapeStylesheet,
      userZoomingEnabled: true,
      userPanningEnabled: true,
      boxSelectionEnabled: false,
      wheelSensitivity: 0.2,
    });
+    cy.layout(defaultLayout).run();

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?