No automatic view update when writing props in matrix

Hi everyone :hugs:

I was trying my luck with the matrix widget and am amazed by it! :smiley:
However there's something I want to point out and I don't know if it's my bad use of scripting in the props field or if it's something else.

My example code is the following:

JS{{
  var props = {}
  props.colorWidget = "rgba(0, "+ (60+(3-Math.round($%4))*15) +", "+ (80+(3-Math.round($%4))*15) +", 1)"
  props.colorStroke = "rgb(128,128,128)"
  props.css = ":host{border-radius: 100%; font-size: 100%; transform: rotate("+(15*$)+"deg);}"
  return props
}}

Now when I change something in the code and hit tab or click somewhere else, the changes don't apply to the widget - I can't see any changes.
My workaround always is to hit Ctl + S and then Ctl + R to refresh the session. The code works tho :wink: But is it not meant to write it like that or is this behaviour normal?
Thanks for any advice and have a lovely evening :slight_smile:

To determine whether the props property has changed or not, it's evaluated with $ equal to 0; if the result is the same as before no change is made to the matrix' children. It's a limitation I havent fixed yet, you can circumvent it by doing unambiguous change (ie changing something that doesn't depend on $) or by injecting a random that will ensure the result changes (props._rand = Math.random()) [edit: doesn't work]

1 Like

How did I not know this! @jean-emmanuel , it might be worth putting this in the menu....

1 Like

Ctrl+R refreshes the page like in a browser, it'll reload the session automatically if the server's load option is set, and the widget's values will be lost (unless there's another client connected).

Awesome! Nice trick :smiley: I'll use this. Thank you, that's a timesaver :slight_smile:

I found this, because it's a habbit of mine :wink: Feels very natural tho.

Makes sense. Refresh the browser. Silly I missed it.

1 Like

Okay unfortunately not the best solution. It just crashed my session after I reloaded. Maximum stack size exceeded. Could not open it anymore from the client. I manually deleted the props._rand in the .json file and could open it again. Phew. Got a bit sweaty there :stuck_out_tongue_winking_eye:

Haha sorry for that, I'm editing the post then.

1 Like

:sweat_smile: :joy:
Thank you. I'll stick to the reloading process for now, since it's not a big deal and I don't need it so often - just for small changes. All the best and have a great weekend

@jean-emmanuel are you still looking for a solution to refresh the props event when it doesn't chnage with $=0?

1 Like

It's already done in sources.

1 Like