Skip to content

Fix variant-switch image caching (issue #79)#82

Merged
emosaru merged 1 commit into
mainfrom
claude/flamboyant-goldstine-d6063f
May 7, 2026
Merged

Fix variant-switch image caching (issue #79)#82
emosaru merged 1 commit into
mainfrom
claude/flamboyant-goldstine-d6063f

Conversation

@emosaru
Copy link
Copy Markdown
Contributor

@emosaru emosaru commented May 7, 2026

Summary

  • ImageReference.FromPackRelativePath now accepts Sessions.PackageInstance directly instead of IGamePackage
  • Each call site derives pi from this.OwnerState (or the already-available state parameter) — no method signature changes in the parse chain
  • Eliminates the ambient PackageInstanceForPackageResolver lookup, which used FirstOrDefault and ignored variant identity, causing all ImageReferences created during a variant-B load to be stamped with variant-A's PackageInstance

Root cause

ActiveSession.PackageInstanceForPackageResolver resolved a PI by matching only on IGamePackage reference (FirstOrDefault). When variant B was loaded for a pack that already had variant A's PI registered, every new ImageReference was stamped with PI_A — so the image cache for the new variant was never consulted and images were always one variant behind.

Test plan

  • Load a pack that has multiple variants
  • Switch variants and confirm images update immediately to the new variant
  • Switch back to the original variant and confirm images are correct

Fixes #79.

🤖 Generated with Claude Code

…omPackRelativePath

ImageReference.FromPackRelativePath now takes Sessions.PackageInstance instead of
IGamePackage. Each call site derives pi from this.OwnerState (or the already-available
state parameter) rather than going through the ambient PackageInstanceForPackageResolver,
which used FirstOrDefault and ignored variant — causing images to be stamped with the
previous variant's PackageInstance when switching variants.

Fixes #79.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@emosaru emosaru requested a review from a team May 7, 2026 06:24
@emosaru emosaru merged commit 994a7bc into main May 7, 2026
3 checks passed
@emosaru emosaru deleted the claude/flamboyant-goldstine-d6063f branch May 7, 2026 06:27
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.

Image caching does not properly handle variant switching

1 participant