DillonHammill / DataEditR

An Interactive R Package for Viewing, Entering Filtering and Editing Data
https://dillonhammill.github.io/DataEditR/
381 stars 40 forks source link

Edits do not save #16

Closed ghost closed 2 years ago

ghost commented 3 years ago

I updated from v. 0.0.5 and the edits I make using the "data_edit" function are no longer reflected in the data frame upon clicking the "done" button (previously the "Save and Close" button). With some testing, I was able to save the edits by clicking the refresh icon, then clicking "done", but that was unintuitive. I have R version 4.0.2 and tested the package alone with no other packages loaded. I tried using data_edit in the browser and in the standard pop-up.

AndyBunn commented 3 years ago

I have the same issue. Edits not saved and then: later: exception occurred while executing callback: invoke_wrapped: throwing std::runtime_error

after sync and done. Screen recording attached.

https://user-images.githubusercontent.com/12534109/103957854-79c90880-5100-11eb-9af0-ba36cfab071c.mov

.

platform x86_64-apple-darwin17.0
arch x86_64
os darwin17.0
system x86_64, darwin17.0
status
major 4
minor 0.2
year 2020
month 06
day 22
svn rev 78730
language R
version.string R version 4.0.2 (2020-06-22) nickname Taking Off Again

DillonHammill commented 3 years ago

The latest version of DataEditR works very differently internally compared to previous versions.

The current version actually maintains two distinct copies of the data, the original entire dataset (we can call this the master copy) and the other is the data that is actually displayed for editing (this is treated as a subset of the master copy). Whenever you make changes to the data you are actually working on the displayed subset and not the master copy.

When you click the DONE button, the master copy of the dataset is always returned, this means that you need to push the SYNC button in order for the changes you have made to be updated in the master copy.

The reasoning behind this approach is that if you make changes by accident, you can always just go back to the master copy which will not contain these entries. In this way you have more control over which changes are added to the master copy by pushing the SYNC button when necessary.

I understand that the SYNC is an extra button that you have to remember to push which may not be desirable. I will need to think about the merits of maintaining two copies of the data and decide whether auto-syncing is a better approach - personally I think the current approach adds more flexibility to data editing and when incorporated in other shiny applications this may be a desirable feature.

Nevertheless, regardless of my decision I think there should be an option that allows the user to turn on auto-sync if they want to. I think it will probably be best to add this as an argument to data_edit() instead of another button within shiny (things will get crowded pretty quickly). For example perhaps we could something like:

mtcars_new <- data_edit(mtcars,
                        auto_sync = TRUE)

Internally, this option should update the master copy whenever the data is edited.

I will play around with this next week and see what I can do.

AntonyRono commented 3 years ago

Any update on this issue?

DillonHammill commented 3 years ago

@AntonyRono, I think this issue has been resolved? If I follow the same steps in the video above, I am able to save the edits after hitting the sync button (which is the desired behaviour). Please can you try the new version and let me know if it works for you?

DillonHammill commented 3 years ago

Also I should mention that you need to install my fork of rhandsontable for this to work properly. Looks like my changes still have not been merged rhandsontable.

devtools::instll_github("DillonHammill/rhandsontable")

I will add this to the website installation instructions.

DillonHammill commented 3 years ago

@AndyBunn can you confirm whether the issue is resolved if you have the above version of rhandsontable installed? I added a patch a while back to specifically handle creation of new columns and NA values. I posted this in a more relevant issue as I didn't notice the NAs until now. See #12 for details.

AndyBunn commented 3 years ago

Yes. This appears to resolve the issue. Thanks!

DillonHammill commented 3 years ago

Thanks @AndyBunn, I just updated the installation instructions on the website to include rhandsontable. I thought these changes would have been merged by now, I will contact the maintainer so that these changes will available on CRAN.

AndyBunn commented 3 years ago

Thanks a zillion!

From: Dillon Hammill @.> Reply-To: DillonHammill/DataEditR @.> Date: Tuesday, May 11, 2021 at 2:29 PM To: DillonHammill/DataEditR @.> Cc: Andy Bunn @.>, Mention @.***> Subject: Re: [DillonHammill/DataEditR] Edits do not save (#16)

Thanks @AndyBunnhttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAndyBunn&data=04%7C01%7Cbunna%40wwu.edu%7C956bd1a2906849f34de408d914c3d7ed%7Cdc46140ce26f43efb0ae00f257f478ff%7C0%7C0%7C637563653644221722%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Uhe2pN2%2FNciHAaboypeODrJg%2FaQDJeFLaJmKGCN9myg%3D&reserved=0, I just updated the installation instructions on the website to include rhandsontable. I thought these changes would have been merged by now, I will contact the maintainer so that these changes will available on CRAN.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FDillonHammill%2FDataEditR%2Fissues%2F16%23issuecomment-839188254&data=04%7C01%7Cbunna%40wwu.edu%7C956bd1a2906849f34de408d914c3d7ed%7Cdc46140ce26f43efb0ae00f257f478ff%7C0%7C0%7C637563653644231715%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=uXxbGcUUalstLDC0pMFJMS5eMe%2BkFbiJRANwykP538Q%3D&reserved=0, or unsubscribehttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAC7UCXJ7NGL4LL25AFDJULLTNGOTDANCNFSM4VWEHRDA&data=04%7C01%7Cbunna%40wwu.edu%7C956bd1a2906849f34de408d914c3d7ed%7Cdc46140ce26f43efb0ae00f257f478ff%7C0%7C0%7C637563653644241707%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=01YlOJA4O4N6uILzAZXJKYQJwQ%2FGZbWu8C9q%2BPq2mzw%3D&reserved=0.

AntonyRono commented 3 years ago

@AntonyRono, I think this issue has been resolved? If I follow the same steps in the video above, I am able to save the edits after hitting the sync button (which is the desired behaviour). Please can you try the new version and let me know if it works for you?

@DillonHammill All good now, after installing rhandsontable. Thank you very much!!

mtyszler commented 3 years ago

Hi @DillonHammill

I'm still having this problem. I can only get the data to be updated by using the sync button

DillonHammill commented 3 years ago

@mtyszler this is by desgn. Have a look at this diagram for an overview of the internals of data_edit(). The entire dataset is returned by default (if cut button isn't used) and so a sync is required. https://user-images.githubusercontent.com/28646736/125406042-bf41f780-e3fb-11eb-8489-e33ee7f7f50e.PNG

I will see if I can automate the syncing of the data using the new dataSync module but for now you have to use the sync button.

mtyszler commented 3 years ago

@mtyszler this is by desgn. Have a look at this diagram for an overview of the internals of data_edit(). The entire dataset is returned by default (if cut button isn't used) and so a sync is required. https://user-images.githubusercontent.com/28646736/125406042-bf41f780-e3fb-11eb-8489-e33ee7f7f50e.PNG

I will see if I can automate the syncing of the data using the new dataSync module but for now you have to use the sync button.

Tks for the clarification. Honestly what I find "dangerous" is that a user will click the Done button or just close the viewer/browser and assume edits had been saved.

So I'll need to warn my users that they need to clink on the sync button to save the changes