Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
Fix passing props when executing script (#190)
Browse files Browse the repository at this point in the history
* Fix execute script props

* Add changeset
  • Loading branch information
adbario authored Oct 24, 2022
1 parent f905016 commit 1ce23f0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/brown-bugs-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@onflow/flow-js-testing": patch
---

Add explicit scoping to arguments for scripts in nested await functions to hint microbunde into doing the right thing
4 changes: 3 additions & 1 deletion src/interaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,14 @@ export const sendTransaction = async (...props) => {
* @returns {Promise<*>}
*/
export const executeScript = async (...props) => {
// This is here to fix an issue with microbundler confusing argument scopes
let _props = props
let result = null,
err = null
const logs = await captureLogs(async () => {
try {
const extractor = extractParameters("script")
const {code, args, limit} = await extractor(props)
const {code, args, limit} = await extractor(_props)

const ix = [fcl.script(code), fcl.limit(limit)]
// add arguments if any
Expand Down

0 comments on commit 1ce23f0

Please sign in to comment.