Figma Variables - Text won't update with conditionals

I am making an add and remove prototype, When I press add it should update the title of the frame on the left with the title of the card on the Right and switch the button to the Remove state, When I press remove on that button it should change the title on the left frame back to its original text and turn the button to the Add state.

But it does not, if I use the else logic it turns the button back to the Add state but the text does not go back to its original assigned text

I have the button assigned to a boolean variable it just turns on and off no hover states etc. I have the frame (On the left) title assigned to CurrentPartTitle and the card items title to Part Title
On click it updates CurrentPartTitle to PartTitle and switches the button to Remove, but When I Press the button again to remove the item only the button changes and the text does not revert back to its original title (Part Title)

I had a more full version of this but because it does not change back I have removed as much as possible to just make it simple to problem solve.

Here is a loom video showing the issue
Video

Hi, Matthew.

If I’m not mistaken when you clicked the add button you made CurrentPartTitle to PartTitle? Which means the value of CurrentPartTitle is already PartTitle, so even if you revert it by setting PartTitle to CurrentPartTitle nothing would really change as from that point CurrentPartTitle is equal to PartTitle.

So, instead of setting it with variables. Change directly the “{string}” or create another string variable that is equal to your default text.

1 Like

Thank you so much!! I understand the logic now I always thought when I set CurrentPartTitle to PartTitle it was more of a toggle than an equals, now that I did it your way it works well :grinning:

1 Like

Not at all, booleans are more of the toggle since it just change values in True or False while for strings, you’re changing directly the value of the string. So for here, you either change directly the string value or create another variable that will be fixed as default value.