Skip to content

Keep the shop detail's tag fetch out of the item tag list - #98

Merged
dadachi merged 1 commit into
mainfrom
fix/item-tags-stale-shop
Oct 13, 2026
Merged

dadachi merged 1 commit into
mainfrom
fix/item-tags-stale-shop

Conversation

@dadachi

@dadachi dadachi commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Why

Verifying the item tag screens on the iPhone against the local API showed that the item tag list can show another shop's tags.

ItemTagRepository.fetchAll(shopId:) is the shop detail's fetch, but it also stored its result in itemTags, which is the item tag list's paged list. When the shop detail of shop A was still loading (or reloading after completing / idling a tag) while the user went on to shop B's item tag list, A's answer arrived last and replaced B's list. The generation guard added earlier only covers reloadPage / loadNextPage.

On the device (temporary on-device test with the real repository and view models against the local API, shops "Verify A" / "Verify B" with 12 tags each): shop A's detail reload started, then shop B's item tag list reload → B's list showed A's tags in 4 of 5 rounds. Switching between lists (A's list interrupted by B's) and between the two shop details was already correct.

Change

fetchAll(shopId:) only returns the tags; the shop detail keeps them itself (ShopDetailViewModel.itemTags), so it no longer touches the list's itemTags. Nothing else read the list after fetchAll.

Tests

  • ItemTagRepositoryPaginationTest.previousShopsDetailFetchDoesNotReplaceAnotherShopsList (local HTTP server holding shop A's answer): B's list keeps b1 and B's meta after A's late fetchAll answer, and fetchAll still returns A's tags.
  • Red check: run on the iPhone before the fix, it failed (repository.itemTags.map(\.id) == ["b1"] got A's tags); passes with the fix.

Local checks

  • make lint: 0 violations, 0 files need formatting
  • Full suite on the iPhone (00008150-0019095C1A08401C): 428 tests in 67 suites passed (1 pre-existing known issue)

Device check (local API)

  • After the fix, the same on-device sequence: B's list shows only B's tags in 5 of 5 rounds; list-to-list and detail-to-detail switching unchanged.
  • New shop time zone (also checked, no change needed): ShopCreateView rendered on the device shows the default zone "(GMT+09:00) Tokyo" (Utility.currentTimeZone() matched a picker tag); after selecting "Hawaii" the row shows "(GMT-10:00) Hawaii", and Save created the shop with time_zone = "Hawaii" in the DB. XCUITest could not be used on this device (UI automation can't be enabled), so the picker selection was set through its binding rather than by a tap.

🤖 Generated with Claude Code

https://claude.ai/code/session_01K5hZEFqXhBsUQwSWsgR6eH

ItemTagRepository.fetchAll (the shop detail's fetch) stored its result in
itemTags, the item tag list's pages. When it answered after the user had
gone on to another shop's item tag list, that list showed the previous
shop's tags. Seen on the iPhone against the local API: shop A's detail
still loading while shop B's list opened left A's tags in B's list. The
shop detail keeps the tags itself, so fetchAll now only returns them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K5hZEFqXhBsUQwSWsgR6eH
@dadachi
dadachi merged commit 48adfeb into main Oct 13, 2026
2 checks passed
@dadachi
dadachi deleted the fix/item-tags-stale-shop branch October 15, 2026 05:29
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