[Bug] asynchronous JavaScript code causes _hyperscript to throw an error

This issue has been tracked since 2022-07-27.

The following code

    init
      log 'before asynchrously succeeding JavaScript'
        js
          return new Promise((resolve,reject) => {
            setTimeout(resolve,2000)
          })
        end
      log 'after asynchrously succeeding JavaScript'

      log 'before asynchrously failing JavaScript'
        js
          return new Promise((resolve,reject) => {
            setTimeout(reject,2000)
          })
        end
      log 'after asynchrously failing JavaScript'
    end

fails with the following error

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'args')
    at o.unifiedEval (hyperscript.org:1:15452)
    at o.unifiedExec (hyperscript.org:1:14547)
    at hyperscript.org:1:14995

before it reaches the second log statement (the one that should write after asynchrously succeeding JavaScript)

A live example can be found here

Note: the exception is thrown in line 1575 of the uncompressed code. It crashes because the command passed to unifiedExec is undefined. It was called from line 1553, where resolvedNext is undefined.

Note: asynchronous JS functions defined within a JS "feature" work as intended (see this example)

More Details About Repo
Owner Name bigskysoftware
Repo Name _hyperscript
Full Name bigskysoftware/_hyperscript
Language JavaScript
Created Date 2020-05-27
Updated Date 2022-11-25
Star Count 1265
Watcher Count 18
Fork Count 75
Issue Count 86

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date