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

Reset resource after exiting edit page without saving. #906

Closed
Polleps opened this issue Jul 9, 2024 · 2 comments · Fixed by #900
Closed

Reset resource after exiting edit page without saving. #906

Polleps opened this issue Jul 9, 2024 · 2 comments · Fixed by #900
Labels

Comments

@Polleps
Copy link
Member

Polleps commented Jul 9, 2024

When editing a resource via the default edit view changes will stay on the resource even when navigating away. The changes are not persisted and are gone when the user refreshes but not when navigating to a different page. This might give the impression the resource is saved to the server and can lead to unintentional data loss.

We should make it so that when the user leaves the edit page the resource gets refreshed so it shows its state from before it was edited.

@Polleps Polleps added the browser label Jul 9, 2024
@joepio
Copy link
Member

joepio commented Jul 9, 2024

Some thoughts:

Form fields (in the edit page) should not update the Resource in the Store. The fact that the store is updated, instead of some local value, is at the heart of this issue.

A refresh after navigating away should fix OPs issue, but it does not fix the underlying issue.

Perhaps the useValue hook deserves some additional thoughts. Live updates (before the commit is signed / accepted) are useful for having a responsive, fast app, but a value should not be set in a Form before the "save" button is pressed, I think.

@Polleps
Copy link
Member Author

Polleps commented Jul 10, 2024

I don't really see a problem with the store being updated. It makes it relatively simple to work with complex shared data throughout the app. Using some kind of clone of the resource or a separate object with values kind of goes against the read/write nature of resources and AtomicData.

Refreshing the resource when the edit form unmounts is also a lot simpler and completely bypasses other issues like dealing with serverside updates of the resource that can introduce merge conflicts with the cloned data.

Polleps added a commit that referenced this issue Jul 15, 2024
Polleps added a commit that referenced this issue Jul 15, 2024
Polleps added a commit that referenced this issue Jul 15, 2024
lippinj referenced this issue in Mikael-Lenander/vihreiden-ohjelma-alusta Jul 23, 2024
* #896 Fix double tap on ios + move new resource buttons

* #893 Fix tables not working from different server

* Tweak new resource buttons appearance

* Change ulid to ulidx lib to support non-secure contexts

* Fix build issue in js cli

* Fix default ontology not generating on first server setup

* Fix resource-array props not removed when input is empty

* Fix dropdowns jumping

* Add TagPage

* Various UI improvements

* Fix type/lint errors

* #906 Reset resource after cancel edit

* Update crossfetch for better node compatibility

* #910 Remove Crossfetch and fix lexical scope for client.fetch

* Fix indicator jumping when scrolling table with keyboard

---------

Co-authored-by: Polle Pas <polleps@gmail.com>
Co-authored-by: Joonas Lipping <lippinj@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants