Skip to content

Fixes for embedded FormProvider #3402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

olemartinorg
Copy link
Contributor

@olemartinorg olemartinorg commented May 28, 2025

Description

I recently added a few Summary2 components to ttd/frontend-test which references all the previous tasks. When doing that, I noticed a few errors in DevTools that weren't there before. It turns out that two unanticipated things happened here:

  1. The Effect* components were rendered inside the node hierarchy, which caused one of the components to try to set preselectedOptionIndex in the database. Since the data model here belonged to a previous task and was locked, FormDataWrite stopped to attempt with an error. This PR prevents these effects from running at all when in a "read only" state such as rendering for Summary2.
  2. If an embedded layout-set sets up dynamics, i.e. rules that run via javascript objects, loading the javascript could end up overwriting dynamics for the parent FormProvider and ruining dynamics there. This can happen if set up in a subform layout-set, but also if rendered via Summary2 pointing to a previous task. This PR adds an error to the DevTools about this, and refuses to run rules in embedded FormProvider.

I still have left to check existing apps and who might be affected by this slight change. I should inform app developers that have set up dynamics when using FormProvider embedding, in addition to documenting when doing such doesn't work as one might think.

Related Issue(s)

Verification/QA

  • Manual functionality testing
    • I have tested these changes manually
    • Creator of the original issue (or service owner) has been contacted for manual testing (or will be contacted when released in alpha)
    • No testing done/necessary
  • Automated tests
    • Unit test(s) have been added/updated
    • Cypress E2E test(s) have been added/updated
    • No automatic tests are needed here (no functional changes/additions)
    • I want someone to help me make some tests
  • UU/WCAG (follow these guidelines until we have our own)
    • I have tested with a screen reader/keyboard navigation/automated wcag validator
    • No testing done/necessary (no DOM/visual changes)
    • I want someone to help me perform accessibility testing
  • User documentation @ altinn-studio-docs
    • Has been added/updated
    • No functionality has been changed/added, so no documentation is needed
    • I will do that later/have created an issue
  • Support in Altinn Studio
    • Issue(s) created for support in Studio
    • This change/feature does not require any changes to Altinn Studio
  • Sprint board
    • The original issue (or this PR itself) has been added to the Team Apps project and to the current sprint board
    • I don't have permissions to do that, please help me out
  • Labels
    • I have added a kind/* and backport* label to this PR for proper release notes grouping
    • I don't have permissions to add labels, please help me out

@olemartinorg olemartinorg added kind/other Pull requests containing chores/repo structure/other changes backport-ignore This PR is a new feature and should not be cherry-picked onto release branches labels May 28, 2025
Copy link

@olemartinorg olemartinorg self-assigned this May 28, 2025
@olemartinorg olemartinorg moved this to 👷 In Progress in Team Apps May 28, 2025
@olemartinorg olemartinorg marked this pull request as ready for review June 5, 2025 10:31
@olemartinorg olemartinorg moved this from 👷 In Progress to 📈 Todo in Team Apps Jun 12, 2025
@olemartinorg olemartinorg moved this from 📈 Todo to 👷 In Progress in Team Apps Jun 12, 2025
@HanneLauritsen1967 HanneLauritsen1967 moved this from 👷 In Progress to 🔎 Review in Team Apps Jun 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-ignore This PR is a new feature and should not be cherry-picked onto release branches kind/other Pull requests containing chores/repo structure/other changes
Projects
Status: 🔎 Review
Development

Successfully merging this pull request may close these issues.

1 participant