Skip to content

Commit

Permalink
Merge pull request #281 from DanielJDufour/bugs/xforms-engine-illegal…
Browse files Browse the repository at this point in the history
…-fetch

fix illegal invocation issue when fetching form xml
  • Loading branch information
eyelidlessness authored Jan 20, 2025
2 parents dd5ee03 + 00517c2 commit 138aac0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/ten-experts-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@getodk/xforms-engine": patch
---

Fix: illegal invocation when fetching form xml
5 changes: 4 additions & 1 deletion packages/xforms-engine/src/instance/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ export interface ResourceOptions {
}

const fetchTextFromURL = async (resource: URL, options: ResourceOptions): Promise<string> => {
const response = await options.fetchResource(resource);
// destructuring prevents "Failed to execute 'fetch' on 'Window': Illegal invocation"
const { fetchResource } = options;

const response = await fetchResource(resource);

return response.text();
};
Expand Down

0 comments on commit 138aac0

Please sign in to comment.