prevwong / reka.js

💎 State management system to build any no-code editor
https://reka.js.org/
MIT License
611 stars 42 forks source link

Issue with Array Initialization in Code #167

Open K1NZ54 opened 3 months ago

K1NZ54 commented 3 months ago

I am experiencing an issue when initializing an array as shown in the attached images. The initialization works correctly when done via the interface, but results in an error when stringified in the code. Specifically, I encounter the error:

Unexpected token (1:10)

This issue also occurs when initializing the array as a JSON object. However, the initialization works fine if the array contains only a single value.

Steps to Reproduce:

  1. Initialize an array in the code as shown in the provided screenshot:

component App(test: any = ["1", "2"]) { val text: any = "Bye"; val counter: any = 0; }


1. Alternatively, initialize the array as a JSON object:

component App(test: any = { "test": ["1", "2"] }) { val text: any = "Bye"; val counter: any = 0; }



1. Attempt to stringify the code.
Expected Behavior:

The array should be initialized without any errors, similar to the behavior observed when the initialization is done via the interface.

Actual Behavior:

The code throws an Unexpected token (1:10) error when attempting to stringify the array initialization.

Thank you.
kyky709 commented 2 months ago

I noticed the same bug. No feedback ?