Anvil tables update not happening actually

While i am glad that you were able to reproduce the bug (the bug wasn’t good but)

I want to make my point that it’s not just an ui update problem. The clone i put here was part of a somewhat bigger hobby project where each coupon was designed to be used only once.

In short, i made a function to check to allow only if coupon code was null (still not used). Guess what? It allows me to use repeatedly, the reason being same, tables not updating sometimes.

It may be a flush problem cuz i printed same dictionary at 3 diff points in same server run and all 3 are same and expected. But that update can’t be seen in ui but internally too it isn’t actually updated.
Seems like a single server run is caching tables and returning correct values but doesn’t get updated till next server call.

1 Like

You’re making an assumption that may or may not be true. In my runs of my simpler app, I saw:

  1. The IDE UI not being updated
  2. The production app returning the right results even after a refresh of the app (so there was no caching involved)
  3. The production app returning the wrong results after a refresh
  4. The IDE UI updating after a few minutes had passed
  5. The row disappearing from the IDE UI. This persisted even through using the refresh button, but matches what you see when the refresh happens slowly (existing UI rows disappear, new UI rows appear).

All of those cannot be explained by either the UI being slow to refresh or the data tables not updating. There’s something more complex going on that needs looked at by the Anvil folks.

1 Like

The only way to rule out the ui is to not involve the ui in the tests. From my point of view you are testing the ide, not your app. And I can tell you that I know that there are problems with the table editor in the ide, one of them (not the only one) is described here.

Were you able to reproduce the problem by checking the content of the table with the server console, without keeping the table open in the ide?

Or by adding a button on the form that shows the content of the last updated row in an alert?

Or by creating a second app that just checks the correct behavior of the first app?

I wasn’t, simply because all I know at this point is that you claim that there is a bug, but still don’t describe how to reproduce it or even how to check the correct behavior. You say something isn’t updated, but I still don’t understand what.

I’m not claiming there is no bug. All I’m saying is that there are tens of thousands of Anvil apps out there and it’s very unlikely (albeit not impossible) that you are the only one affected by this bug. And that there are thousands of users out there and we all are affected by the quirks and bugs of the ide. So I tend to (very strongly) believe that the problem lays either on the way you use the ide to test it, or on a bug in the code.

2 Likes

This inspired me to suggest a new feature, to reduce the occurrence of these issues.

1 Like

An addition to information related to bug is that it is not just limited to simple python objects like dict but affecting text column also.

What i did?
I tried to stored dict as string. In my code its converted using eval to dict, values changed and then again converted to string and pushed for update.
To my surprise, the bug remains as it is.

I can’t reproduce any problems with this clone link. The Anvil IDE is not constantly refreshing so you’ll need to click the “refresh” button next to “Permissions” to refresh the table. I’ve run the app several times and after refreshing the table, everything is updated as expected.

(Thank you for providing a minimal clone link)

In this video, you have clicked the cell in the Data Table and are editing it. Even though you add a new value through the live app, you are actually editing the table in the UI, so whatever might be happening in your app, that value is being overwritten as you edit the table in the UI.

There might be a bug here, but please provide a minimal clone link with followable reproduction steps.

2 Likes

As a reminder to everyone, it is much, much easier for the community to help out if you provide code snippets and/or a clone link to a minimal app with clear, straightforward reproduction steps. Most people (@stefano.menci, @p.colbert and @jshaffstall are exceptional people and we are lucky to have them on this forum) will not take the time to decipher large apps, and you won’t get the help you’re looking for.

5 Likes

I can confirm that’s what was happening with my minimal clone link. The end of the JSON could not be seen in the IDE, so to check it I would start editing the field to see if it had changed. If I did that before refreshing the IDE, editing the field would set it back to the original value.

When I increased the column width enough so I could see the entire JSON string without editing it, a simple refresh of the table in the IDE always showed the new value.

4 Likes

Hmm, seems reasonable. So, there is error only if we see it.

This seems closely related to that Schrodinger’s cat :joy:

I will figure out a way to test if there is error when no one seeing, then would mark it as solved.

Finally, i the issue is solved.
The bug was only there if we want to see it happening live in ui cuz edit mode override the updated value.
Thanks @brooke for your so precise observation we were unable to figure it out ourselves.

Also big thanks to @jshaffstall, @stefano.menci, @p.colbert to acknowledge and keep the issue alive

Additionally, i agree with @p.colbert idea to create a read only mode for tables ui. I agree with him that it will reduce occurance of such bug(confusion).

I’m seeing this in my app. The table only gets updated on the second or third server call. I’ll be posting my example app shortly.

If you read carefully, when “this” happens in your app, means that you are clicking on the table on the ide causing the ide to rewrite the old value to the table.

Whether this is the case or not, please don’t revive this old thread which already has a solution. You can create a new one, and add a link to this for reference if you like.

1 Like

Sorry, I figured out the issue. My bad.