I need to update an app I made last summer, but when I loaded the app into the latest version of Fuse I get errors because click handler arguments don´t contain the data that it used to when I wrote the app. (There might be other errors also, but this is as far as I have gotten)
I have a menu with MenuItem components. Each menu item has a variable text that contains the name of the button. This variable is also exported.
Pseudocode example:
MenuItem component
<Rectangle ux:Class="MenuItem">
<JavaScript>
var Observable = require("FuseJS/Observable");
var text = this.Text.inner();
module.exports = {
text: text
}
</JavaScript>
<MyTextComponent
Value="{Property Text}"
>
</MyTextComponent>
</Rectangle>
In my code the console log for args above will be {"node":{"external_object":{}},"x":89.5,"y":130,"index":0,"localX":89.28315734863281,"localY":59.617332458496094}
Args.data.text.value therefore becomes undefined.
Since I want to use the text value this is a bit of a problem. When I wrote the code args.data.text.value would contain the value of the text variable defined in MenuItem.
I have googled a bit to try to find out if the way arguments for click handlers are handled have changed, but I haven´t found anything.
I have run ´uno clean´ on the original project. The demo project was made from scratch, so running uno clean shouldn’t be necessary?
I now tried the demo project on PC (it was originally developed on Mac) and get the same error. Before running it I updated Fuse from an ancient version to the latest version.
I even tried recreating the project on PC in case there were som kind of weird file formatting error.
It turns out this was a deliberate change to fix a number of underlying issues with data contexts. While your particular project currently doesn’t work and will need some refactoring, it’s all for the better.
The problem is that you’re relying on unfortunate, unplanned-for behaviour that shouldn’t be there in the first place. It’s now gone.
So, as explained in the linked ticket, you have at least two ways to solve this.