SHWotever / SimHub

Multi sim dashboard, bass shaker driver, ....
http://www.simhubdash.com/
722 stars 95 forks source link

possible bug run once section (JS) override/conflict between elements #1632

Closed georgi-iovchev closed 2 weeks ago

georgi-iovchev commented 2 weeks ago

Describe the bug Value of a variable defined in run once section in one element override the value of variable with same name in other other element. Happens only if the main code part of the bindings of the elements are absolutely the same.

Simhub version 9.3.1, upgraded to 9.3.4 and the issue is there too

Third party plugins no

To Reproduce

// Run once javascript section myvar = 1

// Javascript section return myvar

// Run once javascript section myvar = 2

// Javascript section return myvar

Expected behavior Expected result is the "1" "2", but I get "2" "2"

Screenshots image image image image

Log files attached SimHub.txt

Additional context Note1 - in the preview during edit - the the expected result is correct for each element. Note2 - the issue happens only if the main code of the bindings is absolutely same. If i put for example some comment in the code one of the text bindings there is no problem. Note3 - The real use case (when i noticed the problem) was in my dashboard I have some sector related text fields and I wanted same code on all the sectors and just in the runonce section put variable for which sector that element is.

SHWotever commented 2 weeks ago

Hi ! Thanks for the report indeed the run once section was not taking into account into the caching strategy making it see as the same in both cases, I've fixed it for the next version.

Nicolas

georgi-iovchev commented 2 weeks ago

Thank you very much for the fast response :)