passepartout-apple/Passepartout/Library/Sources/AppUI/Views/ProfileEditor
Davide ee8ef34f06
Avoid nested module navigation (#749)
A NavigationLink in VPNProviderContentModifier raised a few questions
about the navigation approach in module views. It turned out that having
a Binding to a local ObservedObject (ProfileEditor) is a recipe for
disaster.

Therefore:

- We don't need a binding to the editor module (the draft), because by
doing so we end up _observing_ the same changes from two properties, the
binding and the editor. This seems to drive SwiftUI crazy and freezes
the app once we navigate from the module to another view (e.g. in
OpenVPN the credentials or the provider server). Use the module binding
as a shortcut, but do not assign the binding to the view to avoid
unnecessary observation.
- Keep .navigationDestination() in the module view, and pass a known
destination to VPNProviderContentModifier. This will save the modifier
from creating a nested NavigationLink destination. The
VPNProviderServerView is now openly instantiated by the module view when
such destination is triggered by the NavigationLink in the modifier.
- Do not implicitly dismiss VPNProviderServerView on selection, let the
presenter take care. In order to do so, we add a .navigationPath
environment key through which the module view can modify the current
navigation stack.
2024-10-23 15:42:54 +02:00
..
DefaultModuleViewFactory.swift Add initial support for providers (#723) 2024-10-11 00:24:06 +02:00
EditableModule+Previews.swift Refactor ProfileEditor to leverage ProfileType (#689) 2024-10-06 13:41:02 +02:00
ModuleSection.swift Redo provider managers lifecycle (#732) 2024-10-13 11:36:34 +02:00
ModuleViewFactory.swift Reorganize library into AppUI (#621) 2024-09-26 23:13:55 +02:00
ModuleViewModifier.swift Add initial support for providers (#723) 2024-10-11 00:24:06 +02:00
ProfileEditor+UI.swift Avoid nested module navigation (#749) 2024-10-23 15:42:54 +02:00