Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-adds Reducer.forEach method removed in 1.4 #2570

Merged
merged 5 commits into from
Nov 15, 2023
Merged

Re-adds Reducer.forEach method removed in 1.4 #2570

merged 5 commits into from
Nov 15, 2023

Conversation

rhysm94
Copy link
Contributor

@rhysm94 rhysm94 commented Nov 15, 2023

TCA 1.4 perhaps unintentionally removed the Reducer.forEach code which allowed creating a ForEachReducer with a AnyCasePath<Action, (ID, ElementAction)> as the action parameter.
Unfortunately, it seems that:

AnyCasePath<Action, (ID, ElementAction)>, and
AnyCasePath<Action, (id: ID, action: ElementAction)>

are not (always) considered equivalent by the Swift compiler.

The helper library, TCACoordinators, relies on the previous behaviour by passing an AnyCasePath<Action, (ID, ElementAction)>. I have tried updating TCACoordinators to use AnyCasePath<Action, (id: ID, action: ElementAction)>, but this has the effect of breaking TCACoordinators when used with TCA 1.3. Without re-adding this particular method, TCACoordinators cannot compile in a way that works with both TCA 1.3 and TCA 1.4. With this small change, TCACoordinators compiles and works just fine!

@rhysm94 rhysm94 changed the title Re-adds an initialiser that was removed in 1.4 Re-adds Reducer.forEach method removed in 1.4 Nov 15, 2023
Only have two overloads:

- `CaseKeyPath` to an `IdentifiedAction`
- Deprecated `AnyCasePath` to an unnamed tuple
@stephencelis
Copy link
Member

@rhysm94 Thanks for pointing out the problem! I think we introduced more churn here than we should have. I've updated your PR to fix the old AnyCasePath API and require the new CaseKeyPath API go through IdentifiedAction. While it's technically a small breaking change, the API was introduced already deprecated and we don't think folks should have adopted it.

@rhysm94
Copy link
Contributor Author

rhysm94 commented Nov 15, 2023

@stephencelis Thanks for that! That's great, I'm glad it was possible to make it simpler!
Tested the change on my own mirror branch, and it worked perfectly. Happily, TCACoordinators works without issue with these changes in!

@stephencelis stephencelis merged commit 2cdbe3f into pointfreeco:main Nov 15, 2023
3 of 5 checks passed
cgrindel-self-hosted-renovate bot referenced this pull request in cgrindel/rules_swift_package_manager Nov 15, 2023
…ure to from: "1.4.2" (#737)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
|
[pointfreeco/swift-composable-architecture](https://togithub.com/pointfreeco/swift-composable-architecture)
| minor | `from: "1.3.0"` -> `from: "1.4.2"` |

---

### Release Notes

<details>
<summary>pointfreeco/swift-composable-architecture
(pointfreeco/swift-composable-architecture)</summary>

###
[`v1.4.2`](https://togithub.com/pointfreeco/swift-composable-architecture/releases/tag/1.4.2)

[Compare
Source](https://togithub.com/pointfreeco/swift-composable-architecture/compare/1.4.1...1.4.2)

#### What's Changed

- Fixed: `swift-case-paths` is now correctly pinned from 1.1.0, which
should avoid some SPM resolution issues (thanks
[@&#8203;bdolewski-intellias](https://togithub.com/bdolewski-intellias),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2577](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2577)).

#### New Contributors

-
[@&#8203;bdolewski-intellias](https://togithub.com/bdolewski-intellias)
made their first contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2577](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2577)

**Full Changelog**:
pointfreeco/swift-composable-architecture@1.4.1...1.4.2

###
[`v1.4.1`](https://togithub.com/pointfreeco/swift-composable-architecture/releases/tag/1.4.1)

[Compare
Source](https://togithub.com/pointfreeco/swift-composable-architecture/compare/1.4.0...1.4.1)

#### What's Changed

- Fixed: A regression in `Reducer.forEach` was introduced in 1.4 that
broke compilation in some cases, notably in the TCACoordinators library.
This regression has been corrected (thanks
[@&#8203;rhysm94](https://togithub.com/rhysm94),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2570](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2570)).
- Infrastructure: Updated Japanese and Korean README translations
(thanks [@&#8203;Achoo-kr](https://togithub.com/Achoo-kr),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2563](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2563),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2562](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2562)).
- Infrastructure: Fixed documentation links (thanks
[@&#8203;johankool](https://togithub.com/johankool),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2566](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2566),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2576](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2576));
fixed migration guide typos (thanks
[@&#8203;kalupas226](https://togithub.com/kalupas226),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2569](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2569);
[@&#8203;woxtu](https://togithub.com/woxtu),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2575](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2575);
[@&#8203;Ryu0118](https://togithub.com/Ryu0118),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2574](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2574)).
- Infrastructure: Clean up case study (thanks
[@&#8203;mike123789-dev](https://togithub.com/mike123789-dev),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2567](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2567)).

#### New Contributors

- [@&#8203;Achoo-kr](https://togithub.com/Achoo-kr) made their first
contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2563](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2563)
- [@&#8203;mike123789-dev](https://togithub.com/mike123789-dev) made
their first contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2567](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2567)
- [@&#8203;woxtu](https://togithub.com/woxtu) made their first
contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2575](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2575)
- [@&#8203;rhysm94](https://togithub.com/rhysm94) made their first
contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2570](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2570)

**Full Changelog**:
pointfreeco/swift-composable-architecture@1.4.0...1.4.1

###
[`v1.4.0`](https://togithub.com/pointfreeco/swift-composable-architecture/releases/tag/1.4.0)

[Compare
Source](https://togithub.com/pointfreeco/swift-composable-architecture/compare/1.3.0...1.4.0)

#### What's Changed

- Added: The `@Reducer` macro
([https://github.com/pointfreeco/swift-composable-architecture/pull/2553](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2553)).
See the [migration
guide](https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/migratingto1.4/)
for more details.
- Added: Reducer builder support for `any Reducer<State, Action>`
([https://github.com/pointfreeco/swift-composable-architecture/pull/2533](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2533)).
- Fixed: Silenced a SwiftUI sendability warning
([https://github.com/pointfreeco/swift-composable-architecture/pull/2540](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2540)).
- Fixed: Alert and confirmation dialog helpers now use `Text(verbatim:
"")` to avoid localization warnings
([https://github.com/pointfreeco/swift-composable-architecture/pull/2541](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2541)).
- Fixed: `Reducer.onChange` no longer requires an `Equatable`
conformance (thanks
[@&#8203;lukaskubanek](https://togithub.com/lukaskubanek),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2545](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2545)).
- Infrastructure: Updated Swift compiler version to 5.7.1 to follow
Apple's policy (thanks
[@&#8203;jaesung-0o0](https://togithub.com/jaesung-0o0),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2549](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2549)).
- Fixed: Short circuit equatability of ordered sets when counts don't
match
([https://github.com/pointfreeco/swift-composable-architecture/pull/2556](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2556)).
- Infrastructure: Added previews to integration test cases by
([https://github.com/pointfreeco/swift-composable-architecture/pull/2551](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2551))

#### New Contributors

- [@&#8203;lukaskubanek](https://togithub.com/lukaskubanek) made their
first contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2545](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2545)

**Full Changelog**:
pointfreeco/swift-composable-architecture@1.3.0...1.4.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMDAuMCIsInVwZGF0ZWRJblZlciI6IjM2LjEwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: Self-hosted Renovate Bot <361546+cgrindel-self-hosted-renovate[bot]@users.noreply.github.enterprise.com>
@rhysm94 rhysm94 deleted the restore-broken-foreach-initialiser branch November 16, 2023 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants