idyll-lang/idyll

Idyll Editor Variable Hoisting Issue

Open

#671 opened on Nov 17, 2020

View on GitHub
 (0 comments) (0 reactions) (0 assignees)JavaScript (1,977 stars) (97 forks)batch import
DocsEditorRough Edgeshelp wanted

Description

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

Contributor guide