Anvil tables update not happening actually

I was trying to update data tables row which has dictionary object.

The problem is the object is not updated sometimes. Yeah, i was trying since hours and unable to exactly figure out specifically when the problem happening.

I have setup session logs to debug. Everything seems perfect like i printed the dict object before and after update. It was all as expected.

But when i goto tables ui it’s not updated there. And its actually not updated if i try to fetch it later.

Clone link:
anvil.works/build#clone:kwexvymsgt647ar7=etpnesyjacngrmrdlmjoyjrh|c6zzpapn4yyf5nvj=

How to execute
This is PDF containing codes

  1. Enter the code one by one in form and make a choice to update.
  2. Press the back button
  3. Check in tables ui if your choice is updated in coupons column
  4. Enter another code and continue 5-6 times

Extra pieces

  1. Try from an Android phone with chromium based browser, because chances of error are more there
  2. Try with codes in last, not in start

I can suspect that error is from anvil’s side cuz according to session logs everything seems normal

Also got ExecutionTerminatedError: 219f20be33 sometimes with different codes



Here’s the difference between session logs and tables ui you can see

1 Like

I haven’t tried to clone (I’m on my cell now) and the post includes no code, so this is a wild guess based on my own assumptions.

Assuming that your dictionary is stored in a simple object column, it doesn’t work because I assume that you are updating the dictionary instead of updating the row.

Modifying the dictionary only doesn’t work, because the row object doesn’t know that the dictionary is being modified. You need to assign the dictionary to the row object, like the last row here does:

row = app_tables.my_table.search()[0]
dic = row['column_with_dict']
dic['key'] = new_value  # row is not aware of this change
row['column_with_dict'] = dic  # row is finally updated

I have little doubt on my code. The reason for it is that it works many a times but doesn’t some times.
And in those sometimes even verification checks aren’t working.

You can clearly see the difference between print of fetched row vs row in ui.

I have deployed a seperate function too, just to check if row is updated by code. The results are always True but isn’t so in reality.

Well, then you will need to provide more information. The link you provided is not valid and you are not sharing any code. It’s impossible to help you.

With the DB Tables continuously open in the browser, I often find that I must refresh the browser tab, before I see my latest table updates there.

2 Likes

@stefano.menci
The more i tested, it turns out that dictionary update is not happening for its last keys. (I don’t know why, but dicts are not expected to behave like that). Initial keys are working okay. Last keys when tried multiple times, starts to stuck on its old value.
Sorry for the outdated link, try this link instead.

@p.colbert
I tried refreshing the tabs but no luck. Even programmatically, if i make another anvil server call to check, its not updated. So, its not just ui thing. Something at internal database working, i guess.

The app clone works, but it’s impossible to check it without knowing the steps to reproduce the problem and what to look for.

1 Like

You need to run the app and proceed as i described in my original question.

You would enter code and next screen you will see some names and codes next to it.

In users tables, you need to see coupons columns where your chosen code should be visible corresponding to your entered code.

I request you once proceed everything would be understood, otherwise i would upload a detailed video since i see problem as internal(hence complex too)

I tried following the instructions, and this is what I see on the logs, which matches the content of the table:
image

This is not expected behavior.
Since, you made a choice in my app by using the code UULZEU9I, there should be a 5 char value corresponding to EU9I in dictionary.

But according to your Screenshot it’s still None.
I tested today, and the problem is there. Specifically when you are using last of dict keys for updation. Surprisingly its working for initial keys, the reason this bug was away from my eyes.

Can you confirm again?
You have to choose one from table, submit and confirm.
Refresh the page and do this multiple times and see if code corresponding is what displayed corresponding to choice.

I don’t understand the difference between what is supposed to happen and what’s actually happening. I noticed that your screenshot is different from mine, but I don’t know if we both followed the same steps.

After clicking I ConfirmYes

That Green:Blue pair should be there in my dictionary. Is it? Even after multiple tries?

I can understand the confusion in debugging and would try to design an app from scratch just to show the exact bug

For what it’s worth, every time I try it it works. EU9I starts out as null in the data table, and after the operation it has a code. If you can create a smaller app that shows the error you’re seeing, that would go a long way toward narrowing down what’s happening.

1 Like

I don’t see anything wrong with the app, but again, without knowing what you do, what you expect and what you get, it’s difficult to test it.

Very likely I am not following the steps in the same way as you are doing, or I am not checking the same things you are checking.

These are the steps I followed:

  1. clone the app
  2. run the app
  3. type “uulzeu9i”
  4. click on “Choose”
  5. check “Darpan”
  6. click on “I confirm”
  7. click on “Yes”
  8. the last row printed on the console ends with “, ‘EU9I’: ‘D0BWR’}”

Am I following the correct steps?
Am I checking what I am supposed to check?
Is the result correct?

If you don’t provide more info, I can’t reproduce the problem.

@stefano.menci
I confirm you followed steps properly and your results are correct.

Only thing is that it should work multiple times by refreshing the app.

One thing i would request is to do the same in production environment. By clicking publish and visiting the displayed site

Otherwise, I am surely going to make a video of bug and would try to design an app from scratch

Console is okay, but tables ui should also contains the exact same code displayed in console.

Cuz for me too, console is showing correct results, but tables ui is not updated.

Can you please provide the steps, including actions to execute and things to check, similar to what I did in my previous post?

I would rather spend time reproducing and investigating the problem than trying to reverse engineer what I’m supposed to do.

A list of steps is better than a video, because sometimes the same action triggered by a mouse click doesn’t behave the same way as if it’s triggered by a key stroke or another event.

… but a video is better than a list of steps, because the video may show some clue that is not included in the list of steps :slight_smile:

2 Likes

Here’s a video of the bug: Anvil tables not updating sometimes - YouTube

It’s happening sometimes only, so its hard to reproduce the bug. It took hard time for me too to record the video with the bug. Anyway, something is wrong with tables.

Here’s a minimal clone showing the issue (getting rid of all the app specific bits helps to narrow down what’s needed to reproduce the issue): Anvil | Login

In the clone, to reproduce the problem:

  1. Publish the app
  2. Run the app through the published link
  3. Update the value of “foo2” by entering a value in the edit field and click the update button
  4. Verify the update worked by clicking to fetch the value
  5. Go back to the IDE UI to see the data table hasn’t changed

There does seem to be something odd going on. It might just be a delay in the IDE updating, even with the refresh button being used.

In the video I see a lot going on, but I don’t know:

  • what should happen
  • what is happening instead
  • what function doesn’t produce the expected result

One thing that I see is that you have the ide open on the table. I don’t know why you have it open, you don’t explain it, but I know that keeping that page open sometimes rewrites the old data in the row. And I don’t know if that’s the problem either. For example if you open a table and click on a row with the value “x” in a column, then run the app that writes “y”, sometimes that page will write “x” back even if you didn’t explicitly ask for it.

A better way to check the content of a row is to use a server console to execute a search and print the result. It’s faster than clicking and scrolling, you don’t risk to accidentally edit the data and allows you to print a specific item of a large simple object.