-
Notifications
You must be signed in to change notification settings - Fork 32
feature: include what field/component that triggered save #506
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I'm not opposed to this quick-fix (I know we've discussed this for a long time, and there is certainly a need for it), I still think the question is a bit misunderstood. App developers want to know "which field changed here", but with repeating groups it can be an entire row at once. There is also no guarantee there won't be changes in app-frontend-react
causing multiple values to change at the same time. Also, what if you have a spotty internet connection and some requests to save will fail, some will be delayed - that might make the backend miss the event it was looking for. Relying on getting the specific component ID that made the change, and trusting you'll always get that event, I think it's a recipe for subtle bugs in the future. The "proper" way (I think) should be to use a diffing tool in the backend to generate a list of what changed from before, and we already have the tools for that there.
src/altinn-app-frontend/src/features/form/data/submit/submitFormDataSagas.ts
Outdated
Show resolved
Hide resolved
Most definitely see your point. These headers I think should be looked at as a "best effort" at telling the backend what was the cause of this put request, and might not be something we even document out a supported "feature". This solves a need now, and I agree some diffing tool would be better. But that requires more work. And more testing. And more time. @nkylstad do you have have any thoughts on this? I do think @olemartinorg has a great point here. Since BRG technically does not go in production until 1. january, I guess they can live with some extra requests while we implement a better way to tell developers what changed "the proper way". Or, should we merge this and leave it undocumented (or documented with a disclaimer)? Use at your own risk kind of thing. Any ideas, anyone? |
I agree that documenting this with a disclaimer (or not documenting it) will work. When there's a pressing need, this works better than nothing, I guess. @DanRJ: I seem to remember something about you using our JSON diff tool in OED to figure out which data fields have changed in |
Kudos, SonarCloud Quality Gate passed! |
A diff might be something we should look into in the future as a good alternative. Might need some other changes in the backend for that to be viable. I'm merging this, seems harmless and solves real-world issues. |
Description
Adds two header values
field
andcomponentId
when calling put on a data element (which in turns calls processWrite).This enables app developers with some c# knowhow to get the header values from the HTTP-context when running data processing.
Related Issue(s)
Verification
Documentation