pointfreeco / swift-composable-architecture

A library for building applications in a consistent and understandable way, with composition, testing, and ergonomics in mind.
https://www.pointfree.co/collections/composable-architecture
MIT License
12.3k stars 1.43k forks source link

Delay in Reopening Sheet After Dismissal #3195

Closed ammerzon closed 3 months ago

ammerzon commented 3 months ago

Description

I am unsure if this is a bug or standard SwiftUI behavior. It might be related to issue #3045.

Here's a simple example: on a home screen, when a button is clicked, a sheet opens. After dismissing the sheet, clicking the button again doesn't work immediately; there is a delay of a few seconds before it responds. I suspect the state hasn't changed to nil, preventing the sheet from opening immediately. Is this a known issue?

Checklist

Expected behavior

The sheet opens the first time a button is clicked after dismissing the sheet.

Actual behavior

The sheet can't be shown immediately again, but the user must wait a bit.

Steps to reproduce

https://github.com/pointfreeco/swift-composable-architecture/assets/7319168/0ec58569-62bd-434f-9415-6b83b861a9d9

Sheet Bug Project.zip

The Composable Architecture version information

1.11.2

Destination operating system

iOS 17.5

Xcode version information

15.4

Swift Compiler version information

swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0
mbrandonw commented 3 months ago

Hi @ammerzon, this is just how SwiftUI works. If you were to recreate the demo in vanilla SwiftUI you would find that you cannot present a sheet until the existing sheet has fully dismissed.

Since this isn't an issue with the library I am going to convert it to a discussion. Please feel free to continue the conversation over there!