Skip to content

Fix estimated shipping bug#2792

Merged
amy-at-kickstarter merged 2 commits into
mainfrom
feat/adyer/fix-estimated-shipping-bug
Mar 12, 2026
Merged

Fix estimated shipping bug#2792
amy-at-kickstarter merged 2 commits into
mainfrom
feat/adyer/fix-estimated-shipping-bug

Conversation

@amy-at-kickstarter

@amy-at-kickstarter amy-at-kickstarter commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

📲 What

Always return .pledge context for reward cards created in RewardsCollectionViewModel.

🤔 Why

I misunderstood the meaning of this context. A rewards card can be displayed in either RewardsCollectionViewController or ManagePledgeViewController, and it has slightly different display behavior in each. I incorrectly set this to return .manage when the user had already backed the project, which hid the estimated shipping section of the card.

Fixing this makes sure you always see the estimated shipping section of the rewards card during the pledge flow:
Screenshot 2026-03-12 at 9 43 04 AM

@amy-at-kickstarter amy-at-kickstarter Mar 12, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was surprised this issue hadn't been caught by a test. Turns out we didn't have a screenshot test for RewardsCollectionViewController, so I went ahead and added one.

These tests aren't quite perfect (there looks like a bit of a scrolling issue with the selected card), but I verified that they do catch this bug.

final class RewardCardContainerViewTests: TestCase {
func testLive_BackedProject_BackedReward() {
forEachScreenshotType(withData: allRewards, languages: [.en]) { type, rewardTuple in
forEachScreenshotType(withData: Reward.allRewards, languages: [.en]) { type, rewardTuple in

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to reuse this in my new test, so I scoped it under Reward and cleaned it up a bit.

("NoReward", noReward)
]
}()
internal extension Reward {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Git is incorrectly reporting this as more changed than it was, due to moving it around. I made it a static var on extension Reward; added a unique id to each reward; and correctly set the unrestricted shipping rewards to have .preference = .unrestricted.

let itemSize = self.calculateItemSize(from: layout, using: self.collectionView)

if itemSize != layout.itemSize {
layout.itemSize = itemSize

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed an infinite loop which caused the test to hang.

@amy-at-kickstarter amy-at-kickstarter marked this pull request as ready for review March 12, 2026 14:42
@amy-at-kickstarter amy-at-kickstarter requested review from a team and stevestreza-ksr and removed request for a team March 12, 2026 14:54
self.shippingLocationSelectedSignal.signal
)
.map { project, rewards, location in
let context = userIsBackingProject(project) ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the actual bug fix.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me, but there were a bunch of other fixes alongside it in that original PR. Please confirm that all those other changes in this file are still necessary.

@amy-at-kickstarter amy-at-kickstarter Mar 12, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To recap a conversation on Slack:

  1. This refactoring didn't really need to go out in 5.32.0. It's related to featured rewards, and it makes more sense to test all the featured rewards stuff together. Featured rewards are going out in 5.33.0.
  2. I'm reverting PR MBL-2998: Make some small improvements to RewardsCollectionViewModel #2775 in the release branch to fix this bug for 5.32.0
  3. I'll merge this fix to main.

@stevestreza-ksr stevestreza-ksr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once that one comment is addressed, LGTM 👍

self.shippingLocationSelectedSignal.signal
)
.map { project, rewards, location in
let context = userIsBackingProject(project) ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me, but there were a bunch of other fixes alongside it in that original PR. Please confirm that all those other changes in this file are still necessary.

@amy-at-kickstarter amy-at-kickstarter merged commit 421fb99 into main Mar 12, 2026
6 checks passed
@amy-at-kickstarter amy-at-kickstarter deleted the feat/adyer/fix-estimated-shipping-bug branch March 12, 2026 17:42
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