Altinn / app-lib-dotnet

Libraries used in Altinn Apps
BSD 3-Clause "New" or "Revised" License
8 stars 10 forks source link

Ability to ignore some data model paths when running `RemoveHiddenData` #646

Open olemartinorg opened 3 months ago

olemartinorg commented 3 months ago

Description

SSB frequently uses hidden components in a way we did not first consider when developing the RemoveHiddenData functionality. They prefill the data model with values and use always-hidden Dropdown components to show the label for an option in a RepeatingGroup table. This is possible because historically app-frontend have displayed values in the repeating group table even if the components inside are actually hidden (whoops).

This also means that the 'hidden' data is deleted when using RemoveHiddenData. We'll fix this in https://github.com/Altinn/app-frontend-react/issues/1709 by not actually "removing" hidden data, but actually only roll back user changes (and this not being a user change would mean we don't actually remove anything even though the component is hidden).

In the meantime, SSB wishes for functionality to ignore certain paths from being removed by RemoveHiddenData. This, of course, also includes paths in repeating groups (aka properties of objects in arrays).

Additional Information

ivarne commented 3 months ago

I'm not sure I understand this issue. Is it about the config setting AppSettings.RemoveHiddenData or the static method LayoutEvaluator.RemoveHiddenData that they can use in hooks in apps?

If it is the configuration setting for process/next, I don't really see a good place for configuring this behaviour, so I'm a little stuck. The obvious place would be to have a "hiddenDontRemove" : true on the component in the layout, but not sure how frontend will react to that?

olemartinorg commented 3 months ago

Sure, it could be set on the component as well. We would have to introduce a parameter for it in the frontend (which we'd probably never read) so that it's included in the layout JsonSchema, but that could work.

ivarne commented 2 months ago

How about visuallyHidden, as a frontend only feature?

var hideComponent= evaluate("hidden") || evaluate("visuallyHidden") 
kentare commented 2 months ago

+1