Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uploading a spreadsheet with entities with an added property without refreshing page with Import Data from File modal #633

Open
dbemke opened this issue Apr 12, 2024 · 3 comments

Comments

@dbemke
Copy link

dbemke commented Apr 12, 2024

Problem description

If I try to upload a spreadsheet adding entities with a new property which was added at the time when the Import Data from File modal was opened I can see information that I’m trying to upload a file with a property that doesn’t exist. If I reopen the modal the data stay the same. Refreshing the entities page "adds” the new property.
In the screenshot below: the property "age" was added to the dataset and is present in properties of the dataset.

addedProp

URL of the page

https://test.getodk.cloud/

Steps to reproduce the problem

  1. Open 2 tabs with the same project containing a form with entities.
  2. In the first tab go to Entities page to Data tab.
  3. Click "Upload” and "Download a data template”.
  4. In the second tab upload new version of the form with entities (dataset from step 2) with a new property added.
  5. Publish the form so that the new property is added to the dataset.
  6. Open the file with the downloaded template and add a column with a new property and save the file.
  7. Go to the first tab and click "choose one” and upload the file made from the template.

Expected behavior

I'm not sure what should be the expected behavior - updating the list of properties when a file with entities is uploaded/information to refresh the page.

Central version shown in version.txt

https://test.getodk.cloud/
versions:
645a806 (v2023.5.1-3-g645a806)
+5c93766eb558c113a6389f7d035d3bde3fe2261f client (v2023.5.0-47-g5c93766e)
+85a0e3cbcec39c000d29002a9e9bce3150115ac2 server (v2023.5.0-35-g85a0e3cb)

@dbemke
Copy link
Author

dbemke commented Apr 12, 2024

Another similar example: when I delete an entity in a different tab while the Import Data from file modal is opened or I don't refresh the entities page, the Import Data from file modal won't show the change in entities after reopening. The user needs to refresh the entities page. In this case the user isn't blocked by anything just doesn't see the latest changes

@matthew-white
Copy link
Member

Sorry I missed this one, @dbemke!

If I try to upload a spreadsheet adding entities with a new property which was added at the time when the Import Data from File modal was opened I can see information that I’m trying to upload a file with a property that doesn’t exist.

I'm not sure what should be the expected behavior

What you're describing is the expected behavior currently, though I'm also not sure that it's the ideal behavior. This happens because the UI is the one that checks the CSV header, not the backend. The UI compares the CSV header to the properties it knows about, but you're right that if a different tab/browser/device adds a new property, the first tab won't know about it. That will cause the tab not to show the new property in the tables and to reject a CSV file with the new property (and conversely, to accept a CSV file without it).

Adding a new property won't be common, and nothing very bad should happen if a tab doesn't know about the latest properties, so my instinct is that the current behavior is OK. That said, I wanted to connect this issue to two others: one about refreshing stale data that was retrieved a while ago (getodk/central-frontend#204) and one about sharing changes across tabs (#646).

when I delete an entity in a different tab while the Import Data from file modal is opened or I don't refresh the entities page, the Import Data from file modal won't show the change in entities after reopening.

This one is more surprising to me, actually. If you open the modal, then delete an entity in another tab, then close the modal and reopen it, you should see that:

  • The total number of rows has updated
  • The deleted entity is not shown

Is that what you're seeing?

One way to think about it is that the table in the modal is different from the table on the page. Even if the table on the page hasn't been refreshed, the table in the modal should still be up-to-date as of when the modal was opened.

@dbemke
Copy link
Author

dbemke commented Apr 26, 2024

The total number of rows has updated
The deleted entity is not shown

Is that what you're seeing?

Hmm.. Yes now it seems to work as expected so either I made a mistake or there was some extra factor. I'll try to test it a bit more after the regression testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants