fix: drop dead autocorrect helper and invalidate trait timer

Periphery flagged shouldDisableAutocorrect after the debounce path
switched to appliedAutocorrectDisabled. Also cancel autocorrectTraitTimer
on disappear so a pending tick cannot fire after the view is gone.
This commit is contained in:
Taksh 2026-07-31 17:47:31 +03:00
parent d1ce261d93
commit 6f43dcadbc

View File

@ -160,17 +160,12 @@ struct ContentComposerView: View {
.themedChromePanel(edge: .bottom)
.onDisappear {
autocompleteDebounceTimer?.invalidate()
autocorrectTraitTimer?.invalidate()
}
}
}
private extension ContentComposerView {
/// Mirror autocomplete's end-of-string caret: SwiftUI's TextField doesn't
/// expose selection, and suggestions already assume the caret is at the end.
var shouldDisableAutocorrect: Bool {
ComposerAutocorrect.shouldDisable(for: messageText, cursorPosition: messageText.count)
}
/// Debounce trait flips so UIKit isn't asked to reload the keyboard on
/// every character while the user is still deciding the token.
func scheduleAutocorrectTraitUpdate(for text: String) {