[PAY-1990] Fix Crash On Apple Pay Pledge Page #1741
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
π² What
A crash was introduced with the new loading states for the payment sheet. An untested flow allowed the pre-mature update of a section before it had any visible data. This causes a crash related to the table view being out-of-sync with its' data source when reloading.
π€ Why
We don't want to break this page in any way, even if we're introducing a feature hidden behind a flag. All pre-existing flows must work as they always did or conversion rates will go down.
π How
Before we simply took the last section in the table view as "Add New Card" section. This was incorrect because the last section in the table view is not the "Add New Card" section (even though that is the last one we saw visually). It was the "Loading/Shimmer" state.
The key to understanding this is to know how
ValueCellDataSource
creates the sections. When it calls its'set
method, it also calls its'padValuesForSection
method. Which uses the section integer value (an enum raw value in this casePaymentMethodsTableViewSection
) to fill out the empty sections between 0 and the section integer value.That means, the section has been created for
Add New Card
, but during loading it isn't visible because its datasource values are empty but do exist within the UI for the tableview at the time of reload.We just need to check that the reload of that section is updating an actual non-empty value. Again not necessary, but why update something that doesn't exist twice?
π See
Before π
RPReplay_Final1664482675.MP4
After π¦
RPReplay_Final1664837440.MP4
β Acceptance criteria