Hotfix: Add condition check for "paid" cell index value #7113
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.
Closes: #7112
Description
In
OrderDetailsDataSourcerefunds logic is relying on directly accessing array by index. Since refunds list is sharing section with other cells (seelet payment: Section), index is calculated by subtracting 1 for "Payment" and "Paid by Customer" cells.The crash appeared because we added condition to hide "Paid by Customer" when there are no payments yet.
Because index constants are static and not directly connected with section logic - we still subtract "-2" when there is only 1 extra cell in a section.
Fix
Static index replaced by a func (in the same
Constantsnamespace) that requires boolean for its state to remind about the condition.Maybe there is a better way without padding constants? I decided against logic refactor for now.
Testing
Screenshots
RELEASE-NOTES.txtif necessary.