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

Diffing the data model after saving on the backend #1501

Closed
Tracked by #339 ...
olemartinorg opened this issue Sep 25, 2023 · 1 comment
Closed
Tracked by #339 ...

Diffing the data model after saving on the backend #1501

olemartinorg opened this issue Sep 25, 2023 · 1 comment
Assignees
Labels
fe-v4 Issues to be solved before v4 goes gold kind/breaking-change Issue/pull request containing a breaking change kind/feature-request New feature or request

Comments

@olemartinorg
Copy link
Contributor

olemartinorg commented Sep 25, 2023

Description

Currently we send the data model to the backend, which saves it to storage, and sometimes makes changes to it in the process. The backend then diffs the changes using JsonHelper in order to produce a changedFields the app-frontend can use to populate these changes back into the data model.

We should instead swap the responsibility so that the backend instead sends us the entire data model (as it looks after their changes to it), we can produce a diff from what we sent the backend and what we got back, and inject those changes into the current data model (in a way that won't overwrite any changes we've currently made to the data model while the saving request was processing).

This has a few advantages over the current method:

  • The backend doesn't need to know details about the way we store the data model client-side (i.e. dot-notation paths).
  • Logic needed on the backend is reduced, so it may be easier to implement a backend in other languages than C#
  • Casts/changes/omissions on the backend due to a strictly typed data model is easier to catch by the user/app developer. If the data model on the backend removes data not found in the model implicitly, this is not communicated back to the frontend yet - causing problems like Specifying an invalid dataModelBinding in layout silently fails #743.
  • Problems like the infamous 'saving a numeric field with a larger number than is allowed on the backend' may be easier to work around - assuming the backend will be able to cap an input to its min/max limit and return the new model back to us.

Something like this obviously needs to be coordinated with the backend libraries in app-lib-dotnet.

Additional Information

@olemartinorg olemartinorg added kind/feature-request New feature or request kind/breaking-change Issue/pull request containing a breaking change labels Sep 25, 2023
@olemartinorg olemartinorg added the fe-v4 Issues to be solved before v4 goes gold label Sep 25, 2023
@RonnyB71 RonnyB71 mentioned this issue Nov 22, 2023
Closed
@olemartinorg olemartinorg self-assigned this Jan 2, 2024
@olemartinorg olemartinorg moved this to ✅ Done in Team Apps Jan 2, 2024
@olemartinorg
Copy link
Contributor Author

Most of the functionality here is already implemented in #1175 (PR #1712), and the rest will be in #1714.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fe-v4 Issues to be solved before v4 goes gold kind/breaking-change Issue/pull request containing a breaking change kind/feature-request New feature or request
Projects
Archived in project
Development

No branches or pull requests

1 participant