Altinn / Altinn/app-frontend-react

Adapt app-frontend-react to accept reload commands from Studio

Open
#1,088 4 comments 2 reactions 0 assignees View on GitHub
kind/feature-request
Dominant language
TypeScript
Stars
21
Forks
33
Avg merge
6d 23h
Merged PRs (30d)
3

Description

### Description

Studio is implementing a preview functionality where app-frontend is rendered inside an iframe and to enable hot reload it is desirable that app-frontend adapts to resend som calls to app-backend-api which is mocked in Studio backend to get updated versions of config files.

Studio will ask app-frontend to trigger new calls to the following endpoints:
- `.../{org}/{app}/api/resource/{formLayoutName}`
- `.../{org}/{app}/api/v1/texts/{languageCode}`
- `.../{org}/{app}/api/layoutsettings`

These messages will be sent to app-frontend with `contentWindow.postMessage("action: reload-[config]", "[baseurl-of-env-studio-runs]")`

### Additional Information

To separate the calls to the mocked api from the actual app-backend-api it is also desirable that the api-route used for the mocked api ends with the suffix `preview`, resulting in; `{org}/{app}/preview/...`

Contributor guide

Open the contributing guide

Research direction

Start by locating the app-frontend message-handling entry point and the calls for resource layouts, texts, and layout settings. Trace how these calls are routed, then verify the three reload messages and the preview API-route suffix against the Studio postMessage origin and mocked endpoints. Done means each requested reload triggers the corresponding refreshed request without affecting normal backend calls.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
api, frontend
Issue type
Feature
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.