Skip to content

Abnormal behavior for timer in TCA Tutorials #3417

Open
@minjunkim-dev

Description

@minjunkim-dev

Description

I am learning TCA through tutorials.

I found an abnormal behavior for timer in Section 3 of https://pointfreeco.github.io/swift-composable-architecture/main/tutorials/composablearchitecture/01-04-composingfeatures.

After activating each timer in two tabs (tab1, tab2), if you cancel the timer in one tab, the timers in both tabs are canceled.

The same id, "CancelID.timer" (enum case), is registered in the .cancellable(id:) method, so even if only one is canceled, both seem to be cancelled.

I think this behavior is different from what the tutorial intended.

Checklist

  • I have determined whether this bug is also reproducible in a vanilla SwiftUI project.
  • If possible, I've reproduced the issue using the main branch of this package.
  • This issue hasn't been addressed in an existing GitHub issue or discussion.

Expected behavior

The timer on each tab operates “independently.”

Actual behavior

If you cancel the timer on one tab, the timer on the other tab will also be canceled.

Reproducing project

Please refer to Section 3(Deriving child stores) of https://pointfreeco.github.io/swift-composable-architecture/main/tutorials/composablearchitecture/01-04-composingfeatures.

The Composable Architecture version information

1.15.0

Destination operating system

iOS 18

Xcode version information

Xcode 16.0

Swift Compiler version information

swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.10 clang-1600.0.26.2)
Target: arm64-apple-macosx15.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working due to a bug in the library.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions