Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 10, 2025

Problem

As noted in #4409, the network map was previously querying neighbors for all nodes when the graph was rendered, which was inefficient and could cause performance issues. The suggestion was to refresh neighbors for only the specific node when its panel is opened, rather than refreshing all nodes at once.

Solution

This PR implements targeted neighbor refresh by adding a watcher in NodePanel.vue that automatically calls the getNodeNeighbors API when the node panel is opened. This ensures neighbor information is up-to-date for the node being viewed without the overhead of querying all nodes.

Changes

  • Added a watcher on the panel's visibility state (_value computed property)
  • Created a new refreshNodeNeighbors() method that calls the getNodeNeighbors API
  • Only refreshes for non-controller nodes (since controller nodes don't have neighbors in the same sense)
  • Includes silent error handling to gracefully fall back to cached data if the API call fails

Behavior

When a user clicks on a node in the Z-Wave graph to view its details:

  1. The node panel opens
  2. The watcher detects the panel is now visible
  3. If the node is valid and not the controller, getNodeNeighbors is called
  4. Fresh neighbor data is fetched from the Z-Wave controller
  5. The UI automatically updates to show the current neighbor information

This approach is more efficient than the previous implementation, as it only queries the Z-Wave controller for the specific node being examined, rather than all nodes in the network.

Testing

  • ✅ All existing tests pass (51 backend + 52 frontend)
  • ✅ Lint checks pass
  • ✅ Build succeeds
  • ✅ Manually tested with mock Z-Wave controller

Closes #4409

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 224.0.0.251

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>fix(ui): refresh node neighbors when opening node panel in zwave graph</issue_title>
<issue_description>@robertsLando this is why the network map was querying all the neighbors when rendered.
I guess we should do it for a single node when opening the more info popup.

Originally posted by @AlCalzone in #4409 (reply in thread)</issue_description>

<agent_instructions>In zwave graph, when node panel is shown, call API to refresh node neighbors</agent_instructions>

Comments on the Issue (you are @copilot in this section)

Fixes #4412


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: robertsLando <11502495+robertsLando@users.noreply.github.com>
@zwave-js-assistant
Copy link

💡 The pull request title does not match our guidelines 💡

We follow conventional commits, check out the description and examples. This means that the PR title must...

  • start with the type of change, e.g. feat:, or fix:
  • optionally specify a scope, for example we use config for changes to config files: feat(config):
  • contain a description that explains what is being changed, e.g. add a parameter, correct a typo, ...
  • and ideally explains what the change affects, e.g. the device (manufacturer, device label, firmware, ...)

The description should use uppercase and lowercase normally, except for the first character which must be lowercase.

@Copilot Copilot AI changed the title [WIP] Fix refresh of node neighbors in zwave graph panel fix(ui): refresh node neighbors when opening node panel in zwave graph Oct 10, 2025
@Copilot Copilot AI requested a review from robertsLando October 10, 2025 10:18
Copilot finished work on behalf of robertsLando October 10, 2025 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(ui): refresh node neighbors when opening node panel in zwave graph

2 participants