This repository has been archived by the owner on Nov 29, 2023. It is now read-only.
Use client-side transform for preview-by-URL #540
Merged
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.
This is our first step towards migrating to Enketo Transformer's new client build (introduced in enketo/enketo-transformer#171). Preview requests specifying a
form
query parameter will now fetch the XForm directly, and transformation will be performed client-side.We expect that this change will affect few if any users outside of ODK's usage, and the intent is to begin dog-fooding the new client-side Transformer build to evaluate how to proceed with expanding its usage.
In the near term, I expect this will be at least a minor performance improvement across the board, because these preview requests will no longer need to go through the backend proxy. Firefox will typically see a greater performance benefit, because its XSLT implementation is faster than all other target environments.
I have verified this PR works with
None of the others should be impacted, but I'm happy to manually verify that if requested.
What else has been done to verify that this works as intended?
Extensive testing of client-side transform in enketo/enketo-transformer#171.
Why is this the best possible solution? Were any other approaches considered?
It's possible to move more transformation client side, but we want to start small.
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?
This carries the same risks as enketo/enketo-transformer#171; having been tested extensively, we believe those risks are quite low. It also has the same restrictions as any
fetch
.The change does remove the API support for the previous implementation, but that functionality wasn't documented. The only functional change for users is that this change (currently) preemptively loads empty URLs for media, since this preview behavior cannot include media. (I am open to reverting that part of the change, I included it because it reduced the number of errors caught while debugging.)
Do we need any specific form for testing your changes? If so, please attach one.
I tested it in my local ODK Central environment, requesting Central's direct links to XForm definitions.