Emit submission payload(s) to host app #291
Open
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.
Supersedes and closes #289. Closes #23. Closes #290.
I have verified this PR works in these browsers (latest versions):
It would shock me if there's anything browser-specific here.
What else has been done to verify that this works as intended?
Types do much of the work. Added console logs in
FormPreview.vue
demonstrate both handlers working.Why is this the best possible solution? Were any other approaches considered?
I mentioned this in Slack, and will reiterate here: in hindsight, since there are two distinct
SubmissionResult
payload formats, events may not be the best API for this. On the other hand, it may be possible to improve the API by:submissionMaxSize
generic at the component/package boundarysubmit
event emit, implicitly branching the payload type so it's chunked ifsubmissionMaxSize
is non-nullish, monolithic otherwiseThis change already felt big enough (especially compared to the #289 1-liner), so I didn't want to hold it up to explore that. Especially because I'm already kind of uncomfortable with the implicit coupling between a prop and emit, and I'm not sure branching on the prop would ameliorate that!
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
I can't think of anything beyond... this exposes existing functionality to a host application, along with any known or unknown bugs that may already be present.
Do we need any specific form for testing your changes? If so, please attach one.
N/A
What's changed
The main
@getodk/web-forms
component now:MonolithicSubmissionResult
if a host application attaches asubmit
event handlersubmissionMaxSize
propChunkedSubmissionResult
if a host application specifiessubmissionMaxSize
and attaches asubmitChunked
event handler