Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: conditionally show/hide "Continue" button on Confirmation using isFinalCard #4029

Merged
merged 7 commits into from
Dec 3, 2024

Conversation

jessicamcinchak
Copy link
Member

@jessicamcinchak jessicamcinchak commented Dec 2, 2024

Per request here: https://opensystemslab.slack.com/archives/C01E3AC0C03/p1733157241528129

Changes:

  • The Confirmation component now determines if it is the final node in the flow
    • If it is the final node, it will not display a "Continue" button
    • If it is not the final node, it will display a "Continue" button and leave a basic breadcrumb
    • In either scenario, the Confirmation component still never displays a "back" button - which I think is correct/intended behavior as we would not allow someone to change answers post-Confirmation
  • Hides the "Save and return..." link beneath "Continue" if there's a Send component present in our breadcrumbs

Todo:

  • ✅ Add some tests (honestly a little unsettling that this hasn't broken any 😅)

Testing questions:

  • Does this work as expected? Is there any sluggishness introduced when navigating between cards?
  • Is it okay that any node that comes after Confirmation will not be included in a submission payload? Does this impact any of our existing feedback/analytics processes for tracking user satisfaction, etc?
  • Do we need to hide the "Save and resume this application later" link under "Continue" on all nodes after Confirmation?
    • ✅ See note above, now hidden if breadcrumbs include a Send node
  • Do we need to introduce any publish validation rules for types of components that are allowed to come after Confirmation, eg no Pay or Send?

// OSL Slack explanation: https://bit.ly/3x38IRY
return false;
const { upcomingCardIds } = get();
return upcomingCardIds().length === 1;
Copy link
Member Author

@jessicamcinchak jessicamcinchak Dec 2, 2024

Choose a reason for hiding this comment

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

This one's been a long time coming (original commit) & more promising to re-introduce now since upcomingCardIds has been recently refactored to only be responsible for navigation and no longer optimistic auto-answering

Copy link
Contributor

Choose a reason for hiding this comment

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

Very happy to see this commented back in 👍

state.cachedBreadcrumbs,
]);

const handleSubmit = props.handleSubmit;
Copy link
Member Author

@jessicamcinchak jessicamcinchak Dec 2, 2024

Choose a reason for hiding this comment

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

Ideally, in the near future, we can/will re-introduce isFinalCard at the Preview/Node level, but we'll want to do more thorough performance reviews and add test coverage before doing this - so have adjusted this to keep current behavior in the meantime and instead only reference isFinalCard within the Confirmation component itself rather than any component (which should be significantly less expensive / less risky to introduce slugishness)

Copy link
Contributor

Choose a reason for hiding this comment

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

Totally agree - this is the right approach here 👍

Copy link

github-actions bot commented Dec 2, 2024

Removed vultr server and associated DNS entries

@jessicamcinchak jessicamcinchak marked this pull request as ready for review December 3, 2024 08:55
@jessicamcinchak jessicamcinchak requested a review from a team December 3, 2024 08:55
Copy link
Contributor

@DafyddLlyr DafyddLlyr left a comment

Choose a reason for hiding this comment

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

PR description super helpful thanks. Great point about tests - would be super nice to see them added 👍

The question around validation checks is a good one -

  • We probably don't want anything that sets a passport value coming after send (maybe this just needs to be an alert, people may want to do something after send around next steps etc)
  • We can't have Feedback be the final component of a service, as it only inserts a feedback record when "Continue" is hit

// Check if we have a Send node in our breadcrumbs
// This is a better/more immediate proxy for "Submitted" because actual send events that populate lowcal_sessions.submitted_at are queued via Hasura
const hasSent = Object.keys(breadcrumbs)
.reverse()
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: As breadcrumb keys are sorted alphabetically not chronologically this doesn't offer any benefits (despite being a clever and nice optimisation!)

Copy link
Member Author

Choose a reason for hiding this comment

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

ah shoot yes always forget that alphabetical key storage ! I'll remove the .reverse() here and just call .some() directly (at least it stops at first find)

Very much assuming it's NOT worth the expense of sorting, then reversing, then calling .some() - but maybe one to revisit in future

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep - there's a small number of keys here so I think it's also not worth the sorting step really 👍

// OSL Slack explanation: https://bit.ly/3x38IRY
return false;
const { upcomingCardIds } = get();
return upcomingCardIds().length === 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Very happy to see this commented back in 👍

state.cachedBreadcrumbs,
]);

const handleSubmit = props.handleSubmit;
Copy link
Contributor

Choose a reason for hiding this comment

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

Totally agree - this is the right approach here 👍

@jessicamcinchak jessicamcinchak merged commit 5f79efc into main Dec 3, 2024
12 checks passed
@jessicamcinchak jessicamcinchak deleted the jess/confirmation-continue-button branch December 3, 2024 11:10
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