Commit Graph

40 Commits

Author SHA1 Message Date
Cristian Díaz
99da71ff51 Add throttle overloads that take types (#1101)
Co-authored-by: Cristian Díaz <cristian.diaz@monstar-lab.com>
2022-05-19 11:01:29 -04:00
Brandon Williams
79e44cebd4 Ignore errors thrown in fireAndForget. (#1088)
* Ignore errors throw in fireAndForget.

* Update Sources/ComposableArchitecture/Effects/Concurrency.swift

Co-authored-by: Stephen Celis <stephen@stephencelis.com>

* Update Sources/ComposableArchitecture/Effects/Concurrency.swift

Co-authored-by: Stephen Celis <stephen@stephencelis.com>
2022-05-10 10:24:59 -07:00
Brandon Williams
07cd0c2cf3 Add priority to async fireAndForget. (#1084)
* Add priority to async fireAndForget.

* actually use priority
2022-05-06 18:58:04 -07:00
Stephen Celis
f0098d8232 Add cancel overloads that take types (#1078)
* Add cancel overloads that take types

* wip
2022-05-03 21:00:24 -04:00
Stephen Celis
bf521e9e5d Improve performance of type-safe effect cancel token lookup (#1077)
* Add type discriminator to effect cancel id hashing

* wip
2022-05-03 17:35:09 -04:00
Pat Brown
5da277f16f Effect.cancel(ids:) prefer array of ids and deprecate variadic overload (#1041)
* Use array of ids and deprecate variadic overload

* Update Sources/ComposableArchitecture/Internal/Deprecations.swift

Co-authored-by: Stephen Celis <stephen.celis@gmail.com>
2022-03-29 17:09:22 -04:00
Pat Brown
e828aeb496 Effect.cancel(ids:) prefer sequence of ids over variadic list. (#1009)
* Disfavor variadic cancellation

* Changed ids paramter from array to sequence

* Small typo
2022-02-24 10:23:26 -08:00
Pat Brown
ed4c236973 Send completion for cancellation subject (#997) 2022-02-07 09:34:19 -05:00
Stephen Celis
3cbc9d7daf Don't consider an effect in-flight till it's kicked off (#977) 2022-01-21 16:20:35 -05:00
stephencelis
1ab5bb151a Run swift-format 2022-01-21 18:30:06 +00:00
iampatbrown
a9265d435a Cancel in flight effects inline instead of returning concatenated effect (#976) 2022-01-21 13:11:14 -05:00
stephencelis
2975d410d6 Run swift-format 2022-01-07 21:19:35 +00:00
iampatbrown
e5e10d8e87 Update .cancellable implementation to fix #946 (#949)
* Subscribe to upstream publisher instead of PassthroughSubject

* Fixed operator order

* Replaced RunLoop.immediate with RunLoop.test
2022-01-07 16:10:42 -05:00
Stephen Celis
ff41e51a4e Limit async/await to Swift 5.5.2 (Xcode 13.2) (#923) 2021-12-16 16:32:02 -05:00
stephencelis
b85fb40057 Run swift-format 2021-12-13 19:12:18 +00:00
Stephen Celis
23155a04fe Support concurrency backdeployment (#916) 2021-12-13 14:03:15 -05:00
Brandon Williams
c7d7d3cf1a Make sure debounced values are delivered on specified scheduler. (#714)
* Make sure debounced values are delivered on specified scheduler.

* fix deferring too

* wip
2021-08-12 17:50:47 -04:00
stephencelis
b3edfcd3a4 Run swift-format 2021-07-28 18:58:37 +00:00
André Pacheco Neves
d42b471cbd Fix Effect.throttle delayed value shared state cleanup (#683)
Effect.throttle didn't clean up `throttleValues` shared state on the
delayed values path, leading to the first value strategy
(`latest: false`) to return incorrect (old) values on some scenarios.

## Changes

- Add missing `throttleValues[id]` clean up in `Effect.throttle` delayed
value path.
2021-07-28 14:50:49 -04:00
Brandon Williams
c9653cf57b Cancel multiple effects with a variadic list. (#676)
* Cancel multiple effects with a variadic list.

* genericize

* doc fix

* use array
2021-07-26 16:05:50 -04:00
stephencelis
b809888a5b Run swift-format 2021-07-22 17:45:38 +00:00
André Pacheco Neves
65f1fa043f Fix Effect.throttle data races and scheduler value return (#669)
* Fix `Effect.throttle` data races and scheduler value return

The `Effect.throttle` operator had multiple data races when updating
`throttleTimes` and `throttleValues` shared state, because:

1. `Effect.throttle` can be called from any scheduler.
2. The internal `flatMap` runs on the current chain scheduler, but the
throttled (delayed) value runs on the passed in `scheduler` parameter
(which can be different).

By protecting shared state with a lock (similar to the cancellables'),
these data races should be addressed.

Additionally, the `Effect.throttle` should return all values in the
`scheduler` passed in, so that the API contract is honored and values
come from where callers expect them to.

## Changes

- Add new `throttleLock` `recursive lock to protect `throttleTimes`
and `throttleValues` shared state in `Effect.throttle` operator.

- Ensure all values in `Effect.throttle` come from the passed in
`scheduler`.

* Fix `Effect.throttle` tests, Use `sync` lock helper
2021-07-22 13:32:36 -04:00
Stephen Celis
e7dda73c35 Fix Effect.throttle (#654)
* Fix Effect.throttle

Fixes #540.

* Simplify

* Publicize
2021-07-13 11:06:51 -04:00
Wendy Liga
21fee722c7 Deferring Side Effect (#550)
* wip

* revert unexpected changes

* fix typo documentation

* fix another typo

* improve api

* api

* add test case

* revert

* rename to deffered

* remove delay keyword entirely

* remove unneccessary

* Update Sources/ComposableArchitecture/Effects/Deferring.swift

Co-authored-by: Stephen Celis <stephen.celis@gmail.com>
2021-06-24 09:21:03 -04:00
Stephen Celis
d30336ca13 Clean-up pass for DocC (#599) 2021-06-16 08:48:14 -05:00
mbrandonw
e043226f3d Run swift-format 2021-06-14 18:15:34 +00:00
Wendy Liga
1a8bccc62e Support DocC Xcode 13 (#591)
* wip

* finish

* revert back code snippet identation to 5

* Update Sources/ComposableArchitecture/Effect.swift

Co-authored-by: Brandon Williams <135203+mbrandonw@users.noreply.github.com>

Co-authored-by: Brandon Williams <135203+mbrandonw@users.noreply.github.com>
2021-06-14 14:10:08 -04:00
Danny Hertz
440e9c48b2 Cancel in flight timers with the same id (#536) 2021-05-10 07:33:02 -07:00
Brandon Williams
4ea3dfed61 Work around Combine-related crash on iOS 13 (#483)
* Fix Combine crash for iOS 13.

* Clean up

* remove scheme
2021-04-08 08:18:36 -07:00
Stephen Celis
f1faccc3a2 Updated TestStore DSL (#454)
* Update TestStore to support imperative DSL

This gives us better XCTIssue-based error messaging since each line is
captured in the stack.

* Update examples to new testing DSL

* Fix

* Update README.md

* 11.3

* fix

* fix
2021-03-22 13:27:51 -04:00
Stephen Celis
af1dcf09cf Restore original cancellation logic (#245)
* Revert "Run swift-format"

This reverts commit 6a5b8f276f.

* Revert "Fix iOS 14 Cancellation Crash (#244)"

This reverts commit 2bf1be6bcf.

* Xcode 12 CI

* Update ci.yml
2020-08-06 10:04:02 -04:00
stephencelis
6a5b8f276f Run swift-format 2020-08-03 17:57:32 +00:00
Stephen Celis
2bf1be6bcf Fix iOS 14 Cancellation Crash (#244)
* wip

* wip

Co-authored-by: Brandon Williams <mbw234@gmail.com>
2020-08-03 13:56:24 -04:00
Brandon Williams
c2f64aa874 Update docs for Effect.timer and TestStore. (#220)
* Update docs for Effect.timer and TestStore.

* format

* update

* Update Sources/ComposableArchitecture/Effects/Timer.swift

Co-authored-by: Stephen Celis <stephen@stephencelis.com>

* Update Sources/ComposableArchitecture/TestSupport/TestStore.swift

Co-authored-by: Stephen Celis <stephen@stephencelis.com>

* wip

* Update TestStore.swift

Co-authored-by: Stephen Celis <stephen@stephencelis.com>
2020-07-09 10:25:06 -04:00
Brandon Williams
207fdfe1dc Remove schedulers in favor of using combine-schedulers (#184)
* Start using combine-schedulers.

* fixes

* wip
2020-06-15 09:10:28 -05:00
stephencelis
dd707b7bd6 Run swift-format 2020-06-04 17:44:38 +00:00
Stephen Celis
d2d994dff5 Cancellation Fixes (#169)
* Failing test when reusing cancellation id.

* wip

* Clean up

* update test

* Update Tests/ComposableArchitectureTests/TimerTests.swift

* move methods around

* wip

* more

* wip

Co-authored-by: Brandon Williams <mbw234@gmail.com>
2020-06-04 13:38:20 -04:00
Stephen Celis
bf24a8cce0 Avoid simultaneous access crash on double-cancel (#137)
* Avoid simultaneous access crash on double-cancel

* fixes

* fix
2020-05-26 19:14:51 -04:00
Brandon Williams
85a8b832d0 Update docs for Effect.timer (#135) 2020-05-26 09:01:13 -07:00
Brandon Williams
d2240d0e76 The Composable Architecture
Co-authored-by: Stephen Celis <stephen.celis@gmail.com>
2020-05-03 22:26:28 -07:00