From 4e4c03267ab33112a5eeb62499da24da1eba1624 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Thu, 25 Jan 2024 09:12:50 +0200 Subject: [PATCH] Follow up to #2325 - Prevent tighlooping between `makeUIView` and `updateUIView` when creating room calls. --- .../Sources/Screens/CallScreen/View/CallScreen.swift | 3 ++- .../Screens/Other/GenericCallLinkCoordinator.swift | 11 +++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ElementX/Sources/Screens/CallScreen/View/CallScreen.swift b/ElementX/Sources/Screens/CallScreen/View/CallScreen.swift index 6bc886023..fb07696c1 100644 --- a/ElementX/Sources/Screens/CallScreen/View/CallScreen.swift +++ b/ElementX/Sources/Screens/CallScreen/View/CallScreen.swift @@ -23,7 +23,8 @@ struct CallScreen: View { var body: some View { WebView(url: context.viewState.url, viewModelContext: context) - .id(UUID()) + // This URL is stable, forces view reloads if this representable is ever reused for another url + .id(context.viewState.url) .ignoresSafeArea(edges: .bottom) .presentationDragIndicator(.visible) .environment(\.colorScheme, .dark) diff --git a/ElementX/Sources/Screens/Other/GenericCallLinkCoordinator.swift b/ElementX/Sources/Screens/Other/GenericCallLinkCoordinator.swift index 0239a531a..ff69cb075 100644 --- a/ElementX/Sources/Screens/Other/GenericCallLinkCoordinator.swift +++ b/ElementX/Sources/Screens/Other/GenericCallLinkCoordinator.swift @@ -34,12 +34,11 @@ class GenericCallLinkCoordinator: CoordinatorProtocol { } func toPresentable() -> AnyView { - AnyView( - WebView(url: parameters.url) - .id(UUID()) - .ignoresSafeArea(edges: .bottom) - .presentationDragIndicator(.visible) - ) + AnyView(WebView(url: parameters.url) + // This URL is stable, forces view reloads if this representable is ever reused for another url + .id(parameters.url) + .ignoresSafeArea(edges: .bottom) + .presentationDragIndicator(.visible)) } }