Skip to content

nested signals get parsed as strings. #15

Description

@cbhrocks

I am running into an error with how initial signal values are being parsed. Based on your examples here, I should be able to do this:
val person = dataSignals("person" to "{name: 'John Doe', age: 18}")
but the person signal gets initialized to a string, not a js object. heres an example:

div {
    dataSignal("test1", "{child1: 'value', child2: 1}")
    dataSignals("test2" to "{child1: 'value', child2: 1}")
    input {
        dataBind("test1.child1")
    }
    input {
        dataBind("test2.child1")
    }
}

the html generated looks like this (note the single quotes wrapping test1 and tes2 contents):

<div data-signals="{test1: '{child1: \'value\', child2: 1}'}" data-signals="{test2: '{child1: \'value\', child2: 1}'}">
	<input data-bind="test1.child1">
	<input data-bind="test2.child1">
</div>

when the signals are displayed using

pre {
    dataJsonSignals({ Unit }) { }
}

it creates the nested signal path itself, blowing away the entire contents of test1 and test2 signals due to them being initialized as strings and prints the following:

"test1": {
  "child1": ""
},
"test2": {
  "child1": ""
},

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions