# \[Resolved\] Bug with ':plus item' function?

**URL:** <https://forum.bubble.io/t/resolved-bug-with-plus-item-function/15070>\
**Category:** Closed\
**Created:** [June 30, 2017, 11:00pm UTC](https://forum.bubble.io/t/resolved-bug-with-plus-item-function/15070 "2017-06-30T23:00:14Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![rushabh](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/rushabh/32/14144_2.png) [@rushabh](https://forum.bubble.io/u/rushabh)\
**Post date:** [June 30, 2017, 11:00pm UTC](https://forum.bubble.io/t/resolved-bug-with-plus-item-function/15070/1 "2017-06-30T23:00:15Z")

</div>

I have a state called test\_state which is a list of yes and no. When the page is loaded, I want to make it: (yes,no)

Here is how I am doing it.

1. Start with empty state

2. Add (yes)  

3. Add (no)  

Expected result: (yes, no)

I have successfully done this in the past, but on the same app when I try to reproduce it, the state ends up going from (yes) → (no) instead of (yes) → (yes,no). Here is an example: [https://bubble.io/page?name=index&id=states-bug-test&tab=tabs-1](https://bubble.io/page?name=index&id=states-bug-test&tab=tabs-1)

Run it on step-by-step debug mode to reproduce.

BUG?

---

<div class="post-metadata">

**Author:** ![sridharan.s](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/sridharan.s/32/17881_2.png) [@sridharan.s](https://forum.bubble.io/u/sridharan.s)\
**Post date:** [July 1, 2017, 4:06am UTC](https://forum.bubble.io/t/resolved-bug-with-plus-item-function/15070/2 "2017-07-01T04:06:06Z")

</div>

If you want the custom state to store multiple values, then you need to make sure it’s a list. If it’s yes/no, then it’ll only store a single value.

---

<div class="post-metadata">

**Author:** ![rushabh](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/rushabh/32/14144_2.png) [@rushabh](https://forum.bubble.io/u/rushabh)\
**Post date:** [July 1, 2017, 4:35am UTC](https://forum.bubble.io/t/resolved-bug-with-plus-item-function/15070/3 "2017-07-01T04:35:11Z")

</div>

It’s a list.

If it’s not a list, bubble doesn’t let you use the ‘plus item’ function.

I’m 90% sure this is a bug because I have an app where the same workflow I created a few months ago behaves differently. But maybe I’m missing something.

---

<div class="post-metadata">

**Author:** ![sridharan.s](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/sridharan.s/32/17881_2.png) [@sridharan.s](https://forum.bubble.io/u/sridharan.s)\
**Post date:** [July 1, 2017, 4:38am UTC](https://forum.bubble.io/t/resolved-bug-with-plus-item-function/15070/4 "2017-07-01T04:38:16Z")

</div>

I haven’t done much with lists like this so not my area of expertise, per se. Two ideas to test though: 1) try adding a delay between step 1 and step 2 and see if that changes things. 2) try each step by themselves to ensure you get the expected result.

If those don’t shed light on what’s going on, I’d say it’s probably a bug and worth submitting.

---

<div class="post-metadata">

**Author:** ![romanmg](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/romanmg/32/237672_2.png) [@romanmg](https://forum.bubble.io/u/romanmg)\
**Post date:** [July 1, 2017, 5:22am UTC](https://forum.bubble.io/t/resolved-bug-with-plus-item-function/15070/5 "2017-07-01T05:22:54Z")

</div>

Hi @rushabh,

It looks like the actions are running simultaneously. When the debugger reaches the 2nd step in your sequence, it shows that the state is still empty, so I changed the workflow to force the order by scheduling the second step 0.1 second after the first step, and it works. Check it out.

---

<div class="post-metadata">

**Author:** ![mishav](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mishav/32/6420_2.png) [@mishav](https://forum.bubble.io/u/mishav)\
**Post date:** [July 1, 2017, 6:45am UTC](https://forum.bubble.io/t/resolved-bug-with-plus-item-function/15070/6 "2017-07-01T06:45:30Z")

</div>

When the `:plus item` adds an item, like most list operations it causes the list to discard duplicate items.

So to produce an end result of just (no), it would likely have tried to add (no) twice.

@romanmg I’m thinking it is a timing issue, Page Load might be triggering the workflow before the checkbox gets its checked status. Because if your suggestion is correct, the workflow is ignoring one of its own steps, which is of concern! Haha.

**_Edit -_** I tried it step by step, on the second step it shows the list as being empty, so I think @romanmg is partially correct …

step1 get the custom state value : empty list  
step1 add the (yes) to the list  
step1 set the custom state new value: (yes)  
step2 get the custom state value : **empty list** hasn’t seen the new value from step 1.  
step2 add the (no) to the list  
step2 set the custom state new value: (no)

When I put a pause between the steps, the state goes from empty to (yes) to (no), which means either of:  
The workflow can’t see updated custom states it has updated.  
Or the pause is not preventing the step execution, just our seeing its result.

@rushabh can you explain how a list of (yes,no) is useful in your app?

---

<div class="post-metadata">

**Author:** ![rushabh](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/rushabh/32/14144_2.png) [@rushabh](https://forum.bubble.io/u/rushabh)\
**Post date:** [July 5, 2017, 7:22pm UTC](https://forum.bubble.io/t/resolved-bug-with-plus-item-function/15070/7 "2017-07-05T19:22:07Z")

</div>

@romanmg Thanks for figuring that out. But your answer makes me very uneasy.

I understand that workflows have no order in which they run (based on [Changing the order of workflows](http://forum.bubble.io/t/changing-the-order-of-workflows/3035/9) ), but my assumption has been that actions within a workflow have a defined order. And my whole app has been built with this assumption.

In fact, I have had this same workflow in my app for multiple states. And for all of them it works as expected (populates with yes,no), but the behavior seems to have changed for workflows I created after ~1 month ago.

Are you confident that actions running simultaneously is by design?

---

<div class="post-metadata">

**Author:** ![rushabh](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/rushabh/32/14144_2.png) [@rushabh](https://forum.bubble.io/u/rushabh)\
**Post date:** [July 5, 2017, 7:26pm UTC](https://forum.bubble.io/t/resolved-bug-with-plus-item-function/15070/8 "2017-07-05T19:26:25Z")

</div>

> @rushabh can you explain how a list of (yes,no) is useful in your app?

This is for [https://louiesclub.com/](https://louiesclub.com/)

I use the list of (yes,no) in several places. For example, people on their profile state whether they can only host fixed dogs (yes = they can host only non-fixed, no = no preference).

The search by default shows all users where that field is yes & no (hence state is yes,no). But if you state in your profile that your dog IS NOT fixed, then the search excludes people who said they can only host fixed dogs. So when the page is loaded, that state is only populated with no.

Make sense?

---

<div class="post-metadata">

**Author:** ![romanmg](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/romanmg/32/237672_2.png) [@romanmg](https://forum.bubble.io/u/romanmg)\
**Post date:** [July 5, 2017, 7:39pm UTC](https://forum.bubble.io/t/resolved-bug-with-plus-item-function/15070/9 "2017-07-05T19:39:37Z")

</div>

> [@Performance Q&A guide](https://forum.bubble.io/t/performance-q-a-guide/12140/2):
>
> Another thing to keep in mind is that when you use dynamic data such as the result of a search as one of the constraints in a search, we can’t start the second search until we finish the first search, because we don’t know what the correct constraint should be. If the first search only returns a small amount of data, that’s not a big deal, but if it returns a lot of data, and you chain multiple searches together like that, you can create extremely slow pages, because we have to evaluate it all one-at-a-time, **instead of in parallel (which is what we normally try to do).**

> [@Changing the order of workflows](https://forum.bubble.io/t/changing-the-order-of-workflows/3035/5):
>
> Workflows don’t have a sequence, they get run at the same time. So if you have 4 workflows that are triggered by a click on a button, all of them will run at the same time when the user clicks on the button.

So, there are a few discussions about this around the forum regarding sequencing, when Bubble waits to run an action, when it doesn’t, etc. Apparently there are a few factors. @mishav studied the sequence closer than I did, so there might be something more going on than my theory, but I think this is something you’ll need to test more, especially when these lists start to grow on you and other stuff is happening on the page.

Other than that, I read your use case, and I feel like you can restructure a bit. Instead of a list of yes/no’s, why not 1 yes/no for if the User can host 1 type of dog, and another yes/no for hosting 2nd type of dog? If they can host both, both will be yes. If only one, then only one will be yes. The default search would not include a constraint on either yes/no fields to include everyone. If the user’s profile says that his dog is not fixed, then the search would include a constraint to those whose “will host not fixed” yes/no field = yes.

---

<div class="post-metadata">

**Author:** ![emmanuel](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/emmanuel/32/27657_2.png) [@emmanuel](https://forum.bubble.io/u/emmanuel)\
**Post date:** [July 5, 2017, 7:40pm UTC](https://forum.bubble.io/t/resolved-bug-with-plus-item-function/15070/10 "2017-07-05T19:40:25Z")

</div>

@mishav is this the bug you reported? If so, this should be fixed now.

---

<div class="post-metadata">

**Author:** ![rushabh](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/rushabh/32/14144_2.png) [@rushabh](https://forum.bubble.io/u/rushabh)\
**Post date:** [July 5, 2017, 8:06pm UTC](https://forum.bubble.io/t/resolved-bug-with-plus-item-function/15070/11 "2017-07-05T20:06:34Z")

</div>

It seems that the workflow now behaves the way I expected: [https://bubble.io/page?type=page&name=index2&id=states-bug-test&tab=tabs-1](https://bubble.io/page?type=page&name=index2&id=states-bug-test&tab=tabs-1)

So thank you for fixing that.

---

<div class="post-metadata">

**Author:** ![rushabh](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/rushabh/32/14144_2.png) [@rushabh](https://forum.bubble.io/u/rushabh)\
**Post date:** [July 5, 2017, 8:07pm UTC](https://forum.bubble.io/t/resolved-bug-with-plus-item-function/15070/12 "2017-07-05T20:07:16Z")

</div>

It looks like this may have been a bug after all.

The reason I use a list for this is that I don’t have to change the RG source depending on the situation. I.e. the RG source is 'Do a search for users where host\_fixed\_only contains my\_custom\_state. Otherwise I would have to add/remove a constraint depending on the user.

But there are definitely opportunities to optimize further. Perhaps I’ll book a consult with you in future and you can help me with that =)

---

<div class="post-metadata">

**Author:** ![mishav](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mishav/32/6420_2.png) [@mishav](https://forum.bubble.io/u/mishav)\
**Post date:** [July 6, 2017, 8:48am UTC](https://forum.bubble.io/t/resolved-bug-with-plus-item-function/15070/13 "2017-07-06T08:48:02Z")

</div>

@emmanuel yes the same bug, thanks!

@romanmg this bug was the plus item making the list appear empty to subsequent actions in the same workflow.

Yes the majority of issues that look similar are from timing; your advice is great for other situations. : )

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/bubble/original/3X/2/8/2847faa74692c2ffa5d939d3dc3724cdd060d247.png) [@system](https://forum.bubble.io/u/system)\
**Post date:** [July 14, 2017, 11:00pm UTC](https://forum.bubble.io/t/resolved-bug-with-plus-item-function/15070/14 "2017-07-14T23:00:15Z")

</div>

Closed on July 14, 2017, 11:00pm UTC

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