mirror of
https://github.com/appy-one/acebase-core.git
synced 2026-05-24 22:01:23 -06:00
[GH-ISSUE #2] Nice to have: check if changes were made in proxy transaction #1
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/acebase-core#1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @appy-one on GitHub (Feb 26, 2021).
Original GitHub issue: https://github.com/appy-one/acebase-core/issues/2
Originally assigned to: @appy-one on GitHub.
When binding a proxied value to Angular inputs with ngModel but don't want the user inputs to be saved to the db immediately, one could use a proxy transaction that can be committed or rolled back based on the user's decision to save or cancel their edits. It is currently not possible however to query the transaction if any changes were made - which would enable asking the user if they want to save their changes.
Imagine doing this in ngOnInit:
Then imagine Angular doing this while the user edits the form:
Now, the user exits the form without saving:
Nice to have:
I am aware it is possible to use an Angular
FormGroupinstead and checkingform.dirty. However, when not using Angular, this is still nice to have for situations where one can't be sure if changes to the data were made or not.@appy-one commented on GitHub (Feb 26, 2021):
Published with v1.1.0:
tx.hasMutations: whether there are pending mutationstx.mutations: the actual pending mutations to be committed/rolled back