Support multipart saving #187
Labels
fe-v4
Issues required for app-frontend v4 to be shippable
kind/feature-request
New feature or request
org/ssb
Issues relevant for Statistisk sentralbyrå.
Milestone
Description
After Altinn/app-frontend-react/pull/899 is merged, multipart saving will be implemented in
app-frontend-react
. This means that the PUT request for saving the data model can start sending multipart bodies containing not just the datamodel we want to save, but also the paths inside that datamodel that changed (along with their previous values).As an example, here is a request we might send. I've added whitespace to the JSON for readability, although we won't send that in practice.
You now get two objects, not just one:
dataModel
(always named as such, regardless of the data model name - which we don't really know or care about in app-frontend). This is the same object we used to send.previousValues
map. This uses dot-notation to indicate a path inside the data model that changed. For every item that changed, the previous value is listed as the map value. If the path did not exist before, the value will benull
.The above example contains a path inside a repeating group that changed - specifically on row 0.
Another interesting example is seen here. I added 3 rows, with the following values:
Then I deleted the second row (containing the values 3 and 4), which leads to this request:
Notice that the row indexes 1 and 2 had changed (row 0 did not change). Index 1 used to have the values 3 and 4 (but from the data model we can tell they now have the values 5 and 6), while index 2 used to have the values 5 and 6 (but index 2 no longer exists in the data model).
Other things to be aware of:
multiPartSave
feature is enabled (see FeatureSet #188).X-DataField
andX-ComponentId
) are no longer passed to the backend when multipart saving is enabled. It is advised that app developers can choose to enable multipart saving when they are ready for it, although we should encourage them to do so (possibly also updating the template to enable the feature by default for new apps).Additional Information
The text was updated successfully, but these errors were encountered: