Clearing a Custom State sets it to initial value

I am not sure if this is intended or I am doing something wrong, but it’s definitely not logical.

When I try to clear the Custom States value, it returns to the default value.

ScreenRecording2024-09-18at7.58.20PM-ezgif.com-video-to-gif-converter

And I know there are dozens of workarounds for the thing I am trying to achieve. I’m just curious if this behaviour is intended or already answered by the devs.

I can verify that is the behavior. Setting it empty looks like resetting it to default value. Is this a feature or a bug? I don’t know.

chrome_Ulz6ZS1iA9

image

Thanks for your time man, I hope this is a bug and they fix it asap, other workarounds are making things more complicated and taking much more time.

A simple solution that is not complicated is to add another entry to your Color OptionSet called empty and highlighting All if it is Color.empty and your action will set it Color.empty instead of leaving it really empty.

Thanks for the suggestion :call_me_hand:

My guess is that it’s intended. The behavior makes sense if one considers a “default” to be a preselected value when no other value is specified. When the value is set to “empty” (which is actually the absence of a value), the default kicks in.

In a lot of scenarios, this would be the desired behavior, and it’s at least consistent with the behavior of the Initial content fields of Bubble input elements (when the container is reset).

If I understand what you’re trying to accomplish, to get your desired behavior, remove the default and just set the initial value either on page load or when the element first becomes visible.

I’m pretty sure this is a bug… and potentially a major one at that… which could break a lot of things.

It’s not only affecting custom states, but groups and RGs…

Previously, you could set a Group’s datasource to be empty based on a condition. If the condition was met, the data would be empty, regardless of its initial datasource.

The same for a RG - you could set an initial datasource, and have condition which, if true, would make the datasource empty.

I use this concept all the time, in loads of apps.

Now, it seems that’s no longer possible - if a group or RG has an initial datasource, and a conditional to set the datasource to empty, the data remains as the initial datasource.

This was definitely not the case before - I’m also pretty sure you could always clear a custom state, by setting it to an empty value - which would set it to empty, regardless of the default value.

(not to be confused with the ‘Reset Data’ or ‘Clear List’ actions - both of which do NOT set the group or RG data to empty, but back to their original initial values.).

The only workaround is to never have a conditional datasource set to empty, but rather always leave the initial datasource empty, and set it conditionally.

This change could cause a lot of problems for existing apps…

This topic was automatically closed after 14 days. New replies are no longer allowed.