Workshop function occasionally receives previous value of a Workshop Variable

I’m troubleshooting an issue in Workshop where a function occasionally receives the previous value of a Workshop Variable, resulting in incorrect calculations.

The flow is roughly:

Filter selection → Workshop Variable update → Function execution

The function itself appears to work correctly, but sometimes the input passed to the function is one interaction behind. For example:

  • Filter = user, I have defaulted to current user id in this case mine and I don’t have any data, I change the filter to a user who actual has data, all the object tables are loading and I have a button on click on which I have designed a slate module, instead of passing the object set or filter variables to slate, I pass in the filters to a function which in turn builds the input for slate, :sweat_smile: I discovered now that I can use getmessage() and foundry functions and build slate

  • So the users complain that they see previous filter data and re-opening solves the issue, but it is annoying and I checked the function fixed all of its fails, but still the issue persists and I was able to recreate it for once, so I inspected the logs and found the input to the function was wrong, it was the previous filter values, so the function is not the culprit but workshop is passing in the previous filters

    Proof: In the background the object set that uses the same filter has loaded but the slate is blank, because its arguments has the previous filters data, so its not the slate, not the function but workshop passing wrong input (previous values).

My questions:

  1. Has anyone seen Workshop Variables lag behind when used as function inputs?
  2. Why does the issue gets resolved when they just reopen the section?
  3. Are there known event-ordering or state propagation issues that could cause a function to receive a stale value?
  4. Has anyone solved this by changing how values are passed (e.g., using Slate messaging / getMessage()), or was there another root cause?
  5. What is the best way to debug exactly where the stale value is introduced?

Appreciate any ideas, experiences, or even wild theories. At this point I’ll gladly investigate anything that sounds remotely plausible :grinning_face_with_smiling_eyes:

Hi @Sumith, as per my understanding -

You are currently displaying an overlay which always seems to have (-1) values.

And you expect the same “current” updated values of a variable (in this case objectset) is updated everywhere. If I assume that it is a function backed object set and has a parameter, here the user (which is used to filter) is not the latest.

1.Make sure the same parameter variable is passed in both the places

2.The “recompute trigger” should be set to automatic. So, this makes sure the object set variable is always latest as per the user details. Unless you want to have a different user flow.

3.Also important to note → the variable itself. How is it set and when does it update.

And I dont think you need a slate application to do this. It is straight forward, unless you want to parse the filter output and store it as a string

Im sorry if I made wrong assumptions. Let me know if this works.

Thank you for the response @Benutzer7, I am sure I shouldn’t be happy that you encountered a bug, but I am because you got the same one as mine

I will walk you through the issue specifically in my case

so basically, we have couple of different filter widgets such as text string selector, multipass user id and object set filter list and let’s take region as an example filter, let’s say it has option A, on the screen there is an object table that computes, it is computing using lot of functions and variables, in my specific case when I check the lineage there are 10 variables (of which some are function backed and some are workshop variables) which give this object set and zero complaints on this

Now we built a slate with the intention that the same object table that is there on screen, we populate in slate and allow for user edits, while I did not build this slate, it has been made in such a way that the object set on the main screen, would go to a function as input with some additional inputs and that function would make the input to slate, from here I was responsible for the application and the users complain that when the open the slate for the first time it is almost always blank and over the second to infinite times, it is always loading the previous data, until the overlay is reopened

So, when I went through the logs I observed the function was failing as it was calling all objects in the object set exceeding the foundry 100k limit, so I was like maybe the function is not optimized and also my initial thoughts were we are passing a computing object set as a input to the function which is causing the entire issue, users being users told me it was only for region filter (Text selector widget), I wrote a function that would take in the main table object set and the region variable value and return True only if the region matched

but the next challenge was how do I make this variable false when they don’t match, apparently it is not something I know how to do/probably is a platform thing, so in the text selector I started using set variable and set the variable to false by default and once the function gave True, it would hold that value, and the button that opens the overlay I made it conditionally disabled when the variable was False, and everything was working and after function optimization I was able to get rid of first time slate does not load (no function failure in logs)

Side Note: My users explicitly told that they don’t mind the button being disabled for 1 or 2 seconds, all they care about is that the overlay loads the right data

but after this fix they started complaining that other filters are also causing this issue, so I was like I have cracked the fix, just need to replicate it, but apart from text selector I was unable to set target variable to false with multipass user id and object set filter, so I had to pivot

So, I was like the issue is we are passing a computing object set, what if I pass all the raw variables and compute the object set within the function, my assumption being object set takes time to load but variable updates values instantly, this did not work either, still people are able to recreate this bug

To your suggestions, I have tried all of them, I am passing the variables which hold the values of my filters and the function which computes the input to slate is also set to automatic, but nothing has worked

As of now, we have moved to a custom widget using react and it takes in the object set filter which is there on the main screen and it is working fine, that is the experimental tab that you see in my first screenshot

But I am still curious to know if there is a fix to this bug, Thanks for your time just to read this message, think I explained my issue, if there is anything which is grey, do let me know!