NavigationLink pops back one view when a value changes (SwiftUI)

I have an app which detects smart-hubs on the network, then for each smart-hub, detects devices conneted to the hub, then each device has a number of channels.

The first view shows all the smart-hubs. Tap on one, and it moves to the next view, which shows all the devices. Tap on a device and it shows all the channels for the chosen device. Each channel is a Slider.

When I touch the slider in the channel-view, the navigation immediately pops back one level to the device-view!

(See diagram below)

Any idea what is causing this?

The first view has a binding to an array of Controllers. @Binding var controllers: [Controller] It passes a selected controller to the second view @Binding var controller: Controller, which passes the selected device to the third view. @Binding var canDevice: CanDevice

Could you post the complete code, so that one can test it ?

Could you post the complete code, so that one can test it ?

Sorry, it's closed source, and it wouldn't work without a specific smart-hub anyway :-) I'm guessing it has something to do with $Bindings which I haven;t properly understood.

The class heiractchy is something like this: CONTROLLER, has member [Device] an array of devices. Each Device has member [Endpoint] and array of endpoints. (Controller, device and endpoint are all classes)

The first view has a binding to an array of [Controller] When you select an item in the first view it passes the selected Controller to the 2nd view. When you select an item in the second view it passes the selected Device to the 3rd view. The 3rd view shows all the Endpoints in the Device. The slider changes a value in the Endpoint.

I don't see why changing a value in the Endpoint causes the Navigation to jump backwards by one scene!

NavigationLink pops back one view when a value changes (SwiftUI)
 
 
Q