Skip to content

Keep list reloads in the same view branch as loaded data - #107

Merged
dadachi merged 1 commit into
mainfrom
fix/list-content-branch
Oct 16, 2026
Merged

dadachi merged 1 commit into
mainfrom
fix/list-content-branch

Conversation

@dadachi

@dadachi dadachi commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Ports the structural part of MyTurnTagCreator-iOS#164.

Why

List screens drew "reloading with data on screen" (.loading, not empty) in its own switch branch, separate from .hasData. SwiftUI treats them as different views, so each reload rebuilds the list, re-registers its navigationDestination and re-runs its .task. In MyTurnTagCreator 2.1.0 that, together with a reload of the shops after each tag change, became a loop of GET /shops (~2/s) that hit the API's per-IP rate limit. Nothing in this template reloads that way today, so there is no live bug; this removes the trap before a future change springs it.

Change

DataState.listContent(isEmpty:) maps a state to .loading / .list / .failed; a reload with data is .list. Screens: Shops, number tags.

Verification

  • DataStateListContentTest (4 tests); breaking the .loading mapping makes reloadingWithDataKeepsTheList fail.
  • Full unit suite on iPhone 17 Pro Max: 448 tests passed (1 known issue, as before).
  • make lint: SwiftLint 0 violations, SwiftFormat 0 files to format.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LDCmJWEL2WvoVE4ThKsR2a

List screens drew "reloading with data on screen" in its own switch
branch, separate from .hasData. SwiftUI then rebuilds the list on every
reload and re-runs its .task. MyTurnTagCreator hit this as a reload loop
after it began reloading the shops on each tag change; nothing in the
template reloads that way yet, so this removes the trap.

List screens now switch on DataState.listContent(isEmpty:).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LDCmJWEL2WvoVE4ThKsR2a
@dadachi
dadachi merged commit 3f180b1 into main Oct 16, 2026
2 checks passed
@dadachi
dadachi deleted the fix/list-content-branch branch October 16, 2026 11:48
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.

1 participant