My goal: use a variable to determine components’ hidden state.
Issue: The variable’s value is updating based on its underlying reference (resource query results), verified in multiple ways, but the components which reference that variable for their hidden state aren’t updating properly, i.e. not hiding when they should.
Steps I've taken to troubleshoot: Checked states or live evaluations in multiple places; they obviously conflict.
Additional info: (Cloud or Self-hosted, Screenshots)
The component’s hidden state is clearly evaluating to true, however the component is not hiding: there’s no eye with a line through it icon, as designated hidden components when their “Always show in edit mode” flag is on; it shows in Preview mode; and the component’s state in the left pane clearly states hidden:false.
This is a contradiction. I would expect the evaluation of the Hidden value on the right pane to drive the behavior.
To make matters worse, if I cut {{ _.isNil(firstMatchedUser_var.value) }} and re-paste it in, then the component will hide: it’ll get the eye icon and the left pane will change to hidden: true:
Given the above, I don’t think i’m doing anything wrong; I’ve used variable with dynamic values for hiding components for years in Retool. It’s happening for other components in this app. This feels broken.
I’m on Retool Cloud, v3.385.0-9d273a3 (Build 334052)
i can get the behavior i want with a transformer instead of the variable, but why should i have to resort to that? the variable is a simple reference; it doesn’t need transformation.
and variables can be dynamic; their value can be the result of something that changes. i’m using variables with dynamic values in other manners throughout this app ostensibly without issue; it’s just this hiding logic that seems broken.
if what i’m doing is wrong, why is it so easily allowed, and so confusing with what some of Retool’s own inspector tools are telling me vs the others that contradict those?
I tried to reproduce what you're seeing using the same {{_.isNil(firstMatchedUser_var.value) }} expression along with a REST API resource query to dynamically update the variable, but the component behaved as expected on my end, with the state and inspector values staying in sync.
Sorry you’re running into this and I’m glad you found a workaround in the meantime! I’d be happy to dig into this further. Can you DM me a JSON export of your app please? It would be helpful to see how you’re updating the variable so I can try and replicate what's showing in your screenshot.
thanks for your reply, diyaayaq, and sorry for not responding in a timely manner.
i’m assuming this is still happening if i were to switch it back to variable-based, but i don’t feel like i can justify the time needed for further troubleshooting at this stage; the app in question is not that important for us.
@Darren does it make sense to unlist this topic, which apparently hides? It wasn’t a mistaken bug report; it’s very much real. I just don’t have time to engage in back & forth with Retool support troubleshooting it.
I get the urge to not have extra topics in the forums, but what if someone else encounters the same issue, and takes to the forums to search for existing reports? I myself have done that on many occasions, and it’s useful even if the topics I find aren’t “solved” because I can add my case and circumstances to the issue.
That's a fair point, @dguzzo, and exactly the way we typically handle open bug reports! Based on the fact that Diyaa was unable to reproduce this, though, I made the assumption that any underlying bug had been addressed. I'll try to reproduce it myself and let you know what I find.
I tried again to reproduce this, but didn't have any luck. If the bug still exists, it is likely the result of a race condition in larger, more complex apps. I'll re-list the topic in order to potentially gather additional data points!