idyll-lang/idyll

Idyll Editor Variable Hoisting Issue

Open

#671 创建于 2020年11月17日

在 GitHub 查看
 (0 评论) (0 反应) (0 负责人)JavaScript (1,977 star) (97 fork)batch import
DocsEditorRough Edgeshelp wanted

描述

Describe the bug In the Idyll Editor, inserting a variable between a pre-existing variable tag and a pre-existing non-variable tag seems to not hoist the new variable correctly and doesn't bind to other tags that refer to it.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://idyll-lang.org/editor
  2. Delete all the example text
  3. Type in:
[var name:"a" value:1 /]
[display value:a /]

This should render "1.00" correctly on the right hand side.

  1. Type [var name:"b" value:2 /] in between the two tags and change the display value to "b"
[var name:"a" value:1 /]
[var name:"b" value:2 /] // added 
[display value:b /] // change to "b"

The display will disappear and the change to the value "2" won't be registered

Expected behavior Variables should be registered and usable regardless of where they are inserted in the editor (since they are hoisted by the compiler). In the example, the Display component should change to "2.00" and not go blank.

Screenshots var_editor_bug

Additional context From Gitter convo regarding adding a frequency variable to the sin chart example

贡献者指南