Altinn / Altinn/app-frontend-react

Extend component function to work with all data model bindings

Open
#4,297 0 comments 0 reactions 0 assignees View on GitHub
area/logic kind/product-feature squad/data
Dominant language
TypeScript
Stars
21
Forks
33
Avg merge
6d 23h
Merged PRs (30d)
3

Description

Currently, the `component` function in our expression language works with components that have `simpleBinding` only. Now that we have list and object support, we should extend it to work with all kinds of bindings.

## Proposed solution

### For `group` bindings
**Non-repeating groups:** Return an object with the ID's of the sub components as keys. The value of each key should be whatever `component` would return for that component.
**Repeating groups:** Return a list of objects, each of which is built the same way as for non-repeating groups.

We still need to decide what should happen with hidden components. Here are the alternatives:
- Hide the ID's completely from the returning objects
- Return `null` for the hidden values
- Reveal the structure of all lists and objects (inlcuding nested ones), but with `null` for each hidden,value with a primitve type (for better type safety)

### For other bindings
If the component is hidden, return `null`. Otherwise, return an object with the binding names as keys and whatever `dataModel` would return for that key as values.

Contributor guide

Open the contributing guide

Research direction

Start by locating the expression-language component function and the existing dataModel handling for simpleBinding, list, object, and group bindings. Review how hidden components are represented and resolve the open alternatives in the issue before implementing support for non-repeating and repeating groups. Done means component works for every binding type with agreed hidden-value behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.