Jinntec / Fore

Fore - declarative user interfaces in plain HTML
MIT License
82 stars 11 forks source link

bug in project.html #130

Closed JoernT closed 2 years ago

JoernT commented 2 years ago

that demo used to work but now creates an error at:

Uncaught (in promise) TypeError: closestActualFormElement.inScopeVariables.keys is not a function or its return value is not iterable
    at getVariablesInScope (xpath-evaluation.js:216:65)
    at evaluateXPathToFirstNode (xpath-evaluation.js:263:28)
    at FxInsert.evalInContext (ForeElementMixin.js:138:26)
    at FxInsert.execute (abstract-action.js:126:10)
    at forLoop (fx-trigger.js:91:23)
    at FxTrigger.performActions (fx-trigger.js:95:5)
    at HTMLButtonElement.<anonymous> (fx-trigger.js:27:51)

To reproduce: load the page and click on any '+' button next to a 'Checklist' twice - first insert still works fine but second will raise the above error.

Can fix it with the following test for Array:

    if(closestActualFormElement.inScopeVariables.hasOwnProperty('keys')){
      for (const key of closestActualFormElement.inScopeVariables.keys()) {
        const varElement = closestActualFormElement.inScopeVariables.get(key);
        variables[key] = varElement.value;
      }
    }

for this use case but that will cause var tests to fail.

What do you think @DrRataplan ?

JoernT commented 2 years ago

already found this to be a regression caused by my humble attempt to pass in event detail properties into the vars.