Skip to content

When returning the result from the apoc.path.subgraphAll from the server to the function updateWithFunction, the visualization is not updating #351

@kunalj1994

Description

@kunalj1994

Expected Behavior (Mandatory)

The visualization should update with the nodes and relationships from the response.

Actual Behavior (Mandatory)

Nothing happens, but the same query when executed with updateWithCypher function updates the visualization and shows the right nodes and relationships.

How to Reproduce the Problem

By using this query -

MATCH (p) where ID(p) = ${nodeId}
      CALL apoc.path.subgraphAll(p, {
          minLevel: 0,
          maxLevel: 1
      })
      YIELD nodes, relationships
      RETURN nodes, relationships

and capturing the result in a variable and passing it to updateWithFunction.

Simple Example

const config: NeovisConfig = {
  visConfig: {
    height: '100%',
    width: '100%',
    interaction: {
      hover: true,
      hoverConnectedEdges: true,
      selectConnectedEdges: false,
      multiselect: true,
      zoomView: true,
    },
    physics: {
      barnesHut: {
        gravitationalConstant: -50000,
        avoidOverlap: 0.4,
      },
    },
    nodes: {
      shape: 'circle',
      widthConstraint: 80,
    },
    edges: {
      hoverWidth: 2,
      selectionWidth: 0,
      smooth: {
        enabled: true,
        type: 'continuous',
        roundness: 0.15,
      },
      arrows: {
        to: {
          enabled: true,
          type: 'arrow',
          scaleFactor: 0.5,
        },
      },
    },
  },
  groupAsLabel: true,

  initialCypher: 'MATCH (n) RETURN n',
}
Node id can come from the clicked event mentioned below.
const result =  <result of this query - MATCH (p) where ID(p) = ${nodeId}
      CALL apoc.path.subgraphAll(p, {
          minLevel: 0,
          maxLevel: 1
      })
      YIELD nodes, relationships
      RETURN nodes, relationships
}>

vis.registerOnEvent(NeoVisEvents.ClickNodeEvent, e => {
  vis.updateWithFunction(() => result)
})

Specifications (Mandatory)

Currently used versions

Versions

  • OS:macOS
  • Library: 2.1.0
  • Neo4j: 5.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions