From f39812c80d3657aefef5f9936ad1d68295f4f0d7 Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Thu, 9 Feb 2023 11:25:50 -0500 Subject: [PATCH] Work around the hang due to infinite layout shifts --- .../ComposeContent/ComposeContentViewModel+DataSource.swift | 1 + .../Scene/ComposeContent/View/ComposeContentView.swift | 1 + 2 files changed, 2 insertions(+) diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel+DataSource.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel+DataSource.swift index fd9cc9d07f..e24ef49c91 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel+DataSource.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel+DataSource.swift @@ -37,6 +37,7 @@ extension ComposeContentViewModel { $contentCellFrame .map { $0.height } .removeDuplicates() + .throttle(for: 0.5, scheduler: RunLoop.main, latest: true) .sink { [weak self] height in guard let self = self else { return } guard !tableView.visibleCells.isEmpty else { return } diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/View/ComposeContentView.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/View/ComposeContentView.swift index d540985b5f..02a9682560 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/View/ComposeContentView.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/View/ComposeContentView.swift @@ -83,6 +83,7 @@ public struct ComposeContentView: View { authorView .padding(.top, 14) .padding(.horizontal, ComposeContentView.margin) + .fixedSize(horizontal: false, vertical: true) // content editor MetaTextViewRepresentable( string: $viewModel.content,