Critical RG bug when sort also changes RG

Update: added simple page that reproduces this bug: see bug app or bug editor.

Seems like this is a critical bug, unless I’m missing something…

For an RG that’s sorted and allows for a change of the field that the sort is based upon, a triggered workflow will sometimes use or act upon the wrong cells’ data! Seems like the sort/resort causes some confusion in the Bubble engine?

Steps to reproduce (using bug sample app):

  • https://gcdemo01.bubbleapps.io/version-test/bug01?debug_mode=true
  • sort by last name
  • change a bunch of “enabled” fields for various cells; notice the yellow highlighted box that indicates the last cell that you’ve acted upon is correct.
  • sort by “enabled?”
  • change a bunch of “enabled” fields for various cells; notice the yellow highlighted box that indicates the last cell that you’ve acted upon is INCORRECT.
  • NOTE: This yellow group always displays the last user acted upon in the RG below (in a workflow for on change of “Enabled?”). When the RG is sorted by “Enabled?” we can see the bug (which seems to stem from Bubble first doing a resort of the RG, and only then the workflow actions act on the OLD “current cell’s” position, which has since changed because of the sort!) When sorted by name, the issue does not happen.

Steps to reproduce (from scratch without bug sample app):

  1. Add field “Enabled?” (yes/no) to Users thing.
  2. Create RG for Users, sort by “Enabled?” field and include the “Enabled?” field as a toggle, with binding to the DB’s field (with requisite privacy permissions).
  3. Add simple workflow, triggered upon change of “Enabled?” that creates a new thing in a Log thing with the user’s email address and the “Enabled?” value.
  4. Make some changes in the “Enabled?” field for various users and check the Log as you make those changes. You’ll notice that there will be many cases where the user logged is NOT the user where you flipped the “Enabled?” field!

Important: This issue does not happen if I turn off the RG sort on “Enabled?” – presumably because the bug is related to the repositioning of the item in the RG and the workflows. The bug demo app indicates that this issue seems to stem from Bubble first doing a resort of the RG, and only then the workflow actions act on the OLD “current cell’s” position, which has since changed because of the sort!)

I’ve experienced the same issue with workflows updating fields of the changed thing but the updates happened to a different record altogether.

Thanks much in advance for any & all advice/feedback.

Best,
Andy

Is this a repost of this issue, or is it something new?

If the former and you can reliably reproduce it, then perhaps submit an official bug report so that Bubble support can take appropriate action.

I’ve reposted the issue after confirming with a couple of bubble gurus that this is indeed a real and serious bug. Was hoping to get the community’s insights before escalating it further. Thx.

Just updated this post to include a simple page app/editor views that easily reproduce the issue.

FWIW, I would agree that it is unexpected behavior. It seems like Bubble is referencing the “Current Cell” by index and grabbing a reference to it AFTER applying the sort (and thus winds up referencing the wrong cell).

I would certainly suggest submitting a bug report.

You’ve done a good job of distilling it into a simple reproducible scenario.

@sudsy thanks for feedback. I’ve done that. I’m a relative newbie bubbler and was sure that I was just doing something wrong but seems like there’s definitely a serious issue here. The odd thing is that I’d expect many thousands of apps to be impacted by this but no mention in the forums.

Well, there’s almost always more than one way to do things in Bubble, and an alternative implementation might not exhibit the issue.

I would have structured the logic quite differently, but I haven’t actually tried it to see if it might be a work-around for you. If I get a chance to do that, I’ll post back here.

1 Like

Would love to see any workarounds that are functional. Thanks much.

For those of you who asked me via PM, here’s where things ended up with Bubble TS. I’m still not sure how to best handle these auto-bind & sort situations, which I’ve relied upon in several places in an app I’m building…


From: Carla Stickler support@bubble.io
Date: Tue, Dec 8, 2020 at 4:01 PM

Hello Andy,

Thanks for your patience while our team looking into the behavior of your repeating group registering the incorrect user. What you appear to be experiencing is a race condition. We have a few actions happening simultaneously and before the workflow can send the data to the group, the autobinding has happened, the sort has happened and the cell that triggered the workflow lags and send the data that is now occupied by that cell instead of the user that you last updated. This kind of behavior is not specific to Bubble and is common in programming when we are trying to have too many actions happen simultaneously causing unexpected behavior.

As a work around to get this working as intended, you may want to send the most recently updated user to your group instead of relying on the cell of the repeating group. Or, you could put the user to be displayed directly in the group with a condition to display the user where their modified date is most recent.

Let us know if you have further questions.


From: Andy Kalati
Date: Fri, Dec 11, 2020 at 1:07 PM
To: support@bubble.io

Thanks for the response…

1-

I understood this to be the issue, but I still think that the issue needs to be escalated to the highest levels at Bubble. Otherwise, directives like “Current Cell’s…” are just wrong and should be “Current Cell’s or another random cell’s…” ! The fact remains that the resort on the RG should only happen after all other workflows have completed.

2-

I don’t see how your proposed workaround would actually work. The “most recently updated user” that you propose has been updated via the autobind, so by the time we get around to sending anything anywhere, we risk the race condition and thus the wrong data being sent/used.

Thanks much,

Andy


From: Carla Stickler support@bubble.io
Date: Fri, Dec 11, 2020 at 2:57 PM
To: Andy Kalati

Hello Andy,

Thank you for reaching back out and I appreciate your concern. I have consulted with our engineering team and they have confirmed that what you’re experiencing is due to the fact that the action to grab the cell isn’t registering that the item has changed fast enough because of the auto binding and the sort happening simultaneously. The work around that I’m suggesting here, removes trying to access the cell while all of these things are changing and goes directly to the database to grab the data. This is why the race to get to the data in the cell does not get affected when you set the data for the group based on the last modified element instead of trying to grab the cell that was last modified. I have tested this out and included a snapshot of what the action would look like to have this functionality working properly.

Let us know if you have further questions!

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