Improve Cancellation Flow, Refactor CancelBag, ScreenActionStore and Error Handling.#20
Closed
ThangKM wants to merge 5 commits intoanthony1810:mainfrom
Closed
Improve Cancellation Flow, Refactor CancelBag, ScreenActionStore and Error Handling.#20ThangKM wants to merge 5 commits intoanthony1810:mainfrom
ThangKM wants to merge 5 commits intoanthony1810:mainfrom
Conversation
…plify ScreenActionStore - CancelBag: auto-remove completed tasks via watch(), add isEmpty/count, accept AnyHashable identifiers, make bag parameter optional - StreamProducer: extract StreamStorage class with deinit cleanup, deprecate nonIsolatedFinish() - ScreenActionStore: replace binding(state:) with receive(action:), add nonisolatedReceive helper with CancelBag support - Add CancelBagTests for auto-removal of completed tasks
…located before completed.
Collaborator
Author
|
Failed Unit Test macOS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improve Cancellation Flow, Refactor CancelBag, ScreenActionStore and Error Handling.
Summary
Refactors the core action dispatching and error handling pipeline.
ScreenActionStorenow centralizes loading state tracking and error presentation in a singledispatchmethod, removing boilerplate from individual store implementations. A newNonPresentableErrorprotocol allows errors to be silently logged instead of shown to the user.Changes
CancelBagCanceller→AnyTask(nowpublic) — callers canawaittask completion viawaitComplete()CancelStrategy→DuplicatePolicy, init parameterduplicate:→onDuplicate:Task.store(in:)now returns@discardableResult AnyTaskTask.immediateon iOS 26+ for eager schedulingDisplayableError& Error HandlingNonPresentableErrorprotocol — errors conforming withisSilent == trueare logged but not shown to the userDisplayableErrornow wrapsoriginalErrorand exposesisSilentinit(error:)initializerScreenActionStorereceive(action:)is nowasync throws— stores simplythrowerrors instead of manually callingshowErrorviewStateassociated type requirement for direct state accessdispatch(action:)methodnonisolatedReceivenow returns@discardableResult AnyTaskAsyncAction#isolationparameter for caller-isolated executionnamepropertyTask.immediateon iOS 26+Tests
TestStoreandTestLoadMoreStoreto the newasync throwsAPINonPresentableError)ScreenStatetKitTests.swiftBug Fix
ternimateLoadmoreView→terminateLoadMoreView