Skip to content

Commit

Permalink
fix: rebuild node routes doesn't update status on node object
Browse files Browse the repository at this point in the history
Fixes #3389
  • Loading branch information
robertsLando committed Oct 30, 2023
1 parent c36ebc8 commit 9c371bf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/ZwaveClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3187,12 +3187,22 @@ class ZwaveClient extends TypedEventEmitter<ZwaveClientEventCallbacks> {
async rebuildNodeRoutes(nodeId: number): Promise<boolean> {
if (this.driverReady) {
let status: RebuildRoutesStatus = 'pending'

const node = this.nodes.get(nodeId)

if (!node) {
throw Error(`Node ${nodeId} not found`)
}

node.rebuildRoutesProgress = status
this.sendToSocket(socketEvents.rebuildRoutesProgress, [
[nodeId, status],
])
const result =
await this._driver.controller.rebuildNodeRoutes(nodeId)
status = result ? 'done' : 'failed'

node.rebuildRoutesProgress = status
this.sendToSocket(socketEvents.rebuildRoutesProgress, [
[nodeId, status],
])
Expand Down

0 comments on commit 9c371bf

Please sign in to comment.