-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
// OSL Slack explanation: https://bit.ly/3x38IRY | ||
return false; | ||
const { upcomingCardIds } = get(); | ||
return upcomingCardIds().length === 1; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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 👍
Removed vultr server and associated DNS entries |
There was a problem hiding this 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() |
There was a problem hiding this comment.
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!)
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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 👍
Per request here: https://opensystemslab.slack.com/archives/C01E3AC0C03/p1733157241528129
Changes:
Todo:
Testing questions: