Altinn / Altinn/app-lib-dotnet

Stateless Frontend Does Not Detect Changes in Hidden Expression When Datamodel Is Updated in ProcessDataRead

Open
#1,414 0 comments 0 reactions 0 assignees View on GitHub
kind/bug status/triage
Dominant language
C#
Stars
8
Forks
27
Avg merge
1h 21m
Merged PRs (30d)
7

Description

### Description of the bug

In a stateless Altinn application, the frontend fails to detect changes in hidden expressions for components when updates are made to the data model in the ProcessDataRead method of IDataProcessor when a new List also is added to the datamodel. This issue occurs unless AltinnRowID is manually added to lists in the data model, even when the field referenced in the hidden expression is not part of the list. This behavior is unexpected and limits the functionality of hidden expressions in stateless applications.

Example of fix in ProcessDataRead

```Transportor transportor = new Transportor
{
garantiInformasjon = new GarantiInformasjon
{
transportorOrgnummer = "311193473", <--- Field used in hidden logic
andreGarantister = new List
{
new AnnenGarantist
{
navn = "testorg",
status = "AKTIV",
AltinnRowId = Guid.NewGuid() <--- Must be included for hidden logic to work
}
},
egneGarantier = new List
{
new Garanti
{
garantitype = "GODS",
status = "AKTIV",
AltinnRowId = Guid.NewGuid() <--- Must be included for hidden logic to work
}
}
}
}
garantist.transportor = transportor;
```

### Steps To Reproduce

1. Create a stateless Altinn application with a component being hidden based on a datamodel field
2. In IDataProcessor.ProcessDataRead change the status of the field in the expression
3. In IDataProcessor.ProcessDataRead initialize a new List without AltinnRowId specified
4. Observe that the frontend does not detect changes in the hidden field.

### Additional Information

[App affected by bug:](https://altinn.studio/repos/erlehaak/transportloyvegarantier/src/commit/eebcfc63fce4fb3d4febf4ab16d8b0f40037e2c0/)

[Statless layout](https://altinn.studio/repos/erlehaak/transportloyvegarantier/src/commit/eebcfc63fce4fb3d4febf4ab16d8b0f40037e2c0/App/ui/stateless/layouts/stateless.json) - Component line 84:

[ProcessDataRead](https://altinn.studio/repos/erlehaak/transportloyvegarantier/src/commit/eebcfc63fce4fb3d4febf4ab16d8b0f40037e2c0/App/logic/DataProcessing/DataProcessor.cs)

Contributor guide

Open the contributing guide

Research direction

Start with the linked stateless layout at component line 84 and App/logic/DataProcessing/DataProcessor.cs in the affected application. Reproduce the case by changing an expression field and initializing a new list without AltinnRowId in ProcessDataRead. Done means the frontend detects the hidden-expression change without requiring AltinnRowId on unrelated list items.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.