Skip to content

Fix payout status alert crash on rewards without a funds transfer, remove dead dashboard prop - #514

Closed
Coleton (Locrian24) wants to merge 1 commit into
1.xfrom
fix/payout-status-npe
Closed

Fix payout status alert crash on rewards without a funds transfer, remove dead dashboard prop#514
Coleton (Locrian24) wants to merge 1 commit into
1.xfrom
fix/payout-status-npe

Conversation

@Locrian24

Copy link
Copy Markdown
Contributor

Two small fixes to 1.x, both found while assessing whether a customer on 1.14.x could safely move to 1.x.

1. <sqm-payout-status-alert> crashes for some participants

getStatus assumed every REDEEMED reward has a partnerFundsTransfer:

reward.statuses.includes("REDEEMED") &&
reward.partnerFundsTransfer.status === "TRANSFERRED"

Rewards that never resulted in a payout (credit rewards, for example) have no funds transfer, so this throws a TypeError and takes out the alert. Three things say this was an oversight rather than intent:

  • saasquatch.d.ts already declares partnerFundsTransfer? as optional.
  • Every other consumer guards it — sqm-rewards-table-status-cell.tsx:72 and sqm-referral-table-rewards-cell.tsx:122 both use ?..
  • sqm-payout-status-alert.feature already specifies this exact case: the | NEW_PAYEE_REVIEW | does not have | N/A | is not shown | row expects the banner to be hidden, not for the component to blow up.

Restored the optional chain and corrected the UserQuery type in data.ts, which declared the field non-nullable and disagreed with both the schema and the surrounding code. With the fix, the missing-transfer case falls through to DONE and the banner stays hidden, matching the feature file.

2. dashboard_noFormNeededSubtext is disconnected

1.15.0 removed noFormNeededSubtext from <sqm-tax-and-cash-dashboard> along with the block that rendered it, but the wrapper <sqm-tax-and-cash> kept declaring dashboard_noFormNeededSubtext. Because extractProps forwards prefixed props generically, the value became an ignored extra key — so tenants could still edit copy in the admin UI that renders nowhere.

Removed it rather than reconnecting it: the dashboard now hides the entire tax document section when no form is needed, so there is no longer a place for that sentence to live. Updated the generated components.d.ts and readme.md to match.

Also

Corrected the 1.15.7 changelog entry, which stated the new registerLabel default was "Choose Your Reward". The value that shipped is "Claim Your Reward".

Test plan

  • tsc --noEmit passes clean on packages/mint-components
  • Verify the payout alert renders for a participant with a REDEEMED credit reward and no partnerFundsTransfer (the previously crashing case)
  • Verify the NEW_PAYEE_REVIEW + transferred reward case still shows the account review banner
  • Confirm no tenant has a saved override for dashboard_noFormNeededSubtext that needs migrating

Follow-up, not in this PR

The 1.15.0 removal of noFormNeededSubtext and taxAndPayoutsDescription from <sqm-tax-and-cash-dashboard> was never recorded in the changelog. Anyone reviewing a 1.14 to 1.15 bump from CHANGELOG.md alone would miss both. Worth backfilling those entries.

…ashboard prop

getStatus assumed every REDEEMED reward has a partnerFundsTransfer, but rewards
that never resulted in a payout do not. saasquatch.d.ts already declares the field
optional and every other consumer guards it, so this restored the optional chain
and corrected the UserQuery type to match. sqm-payout-status-alert.feature already
specified the intended behaviour for this case.

dashboard_noFormNeededSubtext has had no effect since noFormNeededSubtext was
removed from sqm-tax-and-cash-dashboard in 1.15.0, so tenants could still edit copy
that renders nowhere. Removed it rather than reconnecting it, since the dashboard
now hides the whole tax document section when no form is needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant