Skip to content

fix(ui): don't crash fee widget when Pay API fee fetch fails (REGBACKLOG-478) - #1943

Open
panish16 wants to merge 1 commit into
mainfrom
feature-REGBACKLOG-478-fee-unavailable
Open

panish16 wants to merge 1 commit into
mainfrom
feature-REGBACKLOG-478-fee-unavailable

Conversation

@panish16

Copy link
Copy Markdown
Collaborator

Issue:

Description of changes:

  • host-pm-web: application.vue only sets the placeholder service fee when fee1 actually loaded. Before, a failed getFee returned undefined, { ...fee1 } turned it into {} (truthy), and setPlaceholderServiceFee(undefined) was called. The fee store kept that undefined, so on the next visit the fee widget hit undefined.toFixed() while rendering and the page didn't load (you stayed on the dashboard).
  • base-web: setPlaceholderServiceFee falls back to 0 when the fee is undefined, so every app is covered. Note that the UIs build base-web from main, so this part only takes effect after merge.
  • Version bumps: base-web 0.0.64, host 1.3.39. fix(ui): simplify failed-upload cleanup + version bumps (REGBACKLOG-476) #1939 also bumps host to 1.3.39, so whichever merges second needs to bump again.
  • Platform already checks platFeeSm.value before calling it, so no change there.
  • Not in this PR: with fees missing, the widget now shows a $0.00 service fee instead of crashing. Whether users should see a message or be blocked from paying is still an open question on the ticket.

How this was tested:

  • Unit / integration tests run:
    • base-web: new connect-fee-store.spec.ts. It fails without the fix and passes with it. Lint passes; 91/91 pass.
    • host: 2 new tests in application.spec.ts (fee loaded → placeholder set; fee failed → not called). The failure test fails without the fix. Lint passes; 323 pass, 22 skipped. composable-use-renewals.spec.ts times out in a setup hook locally; that happens on clean main too, unrelated to this change.
  • Manual / local / DB verification:
    • Deployed this branch to dev (host UI CD green).
    • Host, dev: made all /fees/ Pay API requests return 500 in the browser, then Resume Draft → breadcrumb back to dashboard → Resume Draft on the same draft. The second visit loads normally, the service fee shows $0.00, and there's no toFixed error.
    • To make sure the test could fail: forcing the store's placeholder service fee back to undefined (the old behaviour) brings back TypeError: Cannot read properties of undefined (reading 'toFixed'), and the Service Fee row disappears.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the BC Registry and Digital Services BSD 3-Clause License

…LOG-478)

When getFee fails it returns undefined. The host application page spread it
into {} (truthy) and passed undefined to setPlaceholderServiceFee, so the fee
widget called undefined.toFixed() on the next render, which aborted navigation
back into an application/draft.

- host: only set the placeholder service fee when fee1 actually loaded
- base: default the placeholder service fee to 0 when undefined
- tests for both
@sonarqubecloud

Copy link
Copy Markdown

@bcregistry-sre

Copy link
Copy Markdown
Collaborator

Temporary Url for review: https://strr-hosts-dev--pr-1943-m91yl5a5.web.app

@severinbeauvais

Copy link
Copy Markdown
Collaborator
  • Not in this PR: with fees missing, the widget now shows a $0.00 service fee instead of crashing. Whether users should see a message or be blocked from paying is still an open question on the ticket.

Check with Pam and Liz so it can be implemented now. My opinion is to do both: show a message and be blocked from submitting (perhaps show the message when submit is clicked and don't actually submit; or an alert somewhere and disable submit).

@severinbeauvais

Copy link
Copy Markdown
Collaborator
  • Not in this PR: with fees missing, the widget now shows a $0.00 service fee instead of crashing. Whether users should see a message or be blocked from paying is still an open question on the ticket.

Check with Pam and Liz so it can be implemented now. My opinion is to do both: show a message and be blocked from submitting (perhaps show the message when submit is clicked and don't actually submit; or an alert somewhere and disable submit).

Showing a $0.00 service fee when Pay is down could make users think there's no service fee, and then they'd see a different total at payment.

@panish16

Copy link
Copy Markdown
Collaborator Author

yeah agree $0.00 is misleading. checking with pam and liz on message + blocking submit, will follow up here once i hear back

This branch was previously deployed

1 inactive deployment
dev — 23c8afa2 Deployed Nov 27, 2026 by panish16 via strr-host-pm-ui-cd / deploy #598
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.

3 participants