WhileTrue/WhileFalse in App

Fuse version: Fuse version 1.0.0 (build 13426)

OS: macOS Sierra 10.12.5 (16F73)

Create new Fuse Project from the GUI. In “MainView.ux” add:

<App>
    <JavaScript File="MainView.js" />

    <WhileTrue Value="{test}">
      <Text>Test is true</Text>
    </WhileTrue>
    <WhileFalse Value="{test}">
      <Text>Test is false</Text>
    </WhileFalse>

    <Button Text="Toggle" Clicked="{toggleTest}" />
</App>

Create “MainView.js” in the root-folder and add:

const Observable = require('FuseJS/Observable');

console.log("MainView.js");

let test = Observable(true);

function toggleTest() {
  console.log("clicked");
  test.value = !test.value;
}

module.exports = {
  test,
  toggleTest
}

View preview. Nothing happens when I click the button and when I’m refreshing the preview I get an error like “System.NullReferenceException: Object reference not set to an instance of an object” and the Problems tab in the log window writes:

{test} not found in data context
{toggleTest} not found in data context
Failed to properly reset. Try exiting Duse and restarting.

If I’m changing “MainView.ux” to look like (the same wrapped in a StackPanel):

<App>
    <JavaScript File="MainView.js" />

    <StackPanel>
      <WhileTrue Value="{test}">
        <Text>Test is true</Text>
      </WhileTrue>
      <WhileFalse Value="{test}">
        <Text>Test is false</Text>
      </WhileFalse>

      <Button Text="Toggle" Clicked="{toggleTest}" />
    </StackPanel>
</App>

Then verything is fine.

Is this supposed to work or am I missing something basic?

Whoa Sculpin, that’s an ugly one you just caught!

Apparently the App tag doesn’t particularly enjoy data-bound triggers as direct children of it, but this certainly shouldn’t end up in a crash. As a workaround, please wrap them in another visual, just like you found it’s working yourself.

I’ve logged an internal ticket for this to be checked and hopefully solved in near future. I would also like to thank you about this wonderful error report with super-clear, minimal reproductions included; made my day!