Skip to content
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

Fix DevTools in subform #2819

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

Fix DevTools in subform #2819

wants to merge 3 commits into from

Conversation

bjosttveit
Copy link
Member

@bjosttveit bjosttveit commented Dec 12, 2024

Description

Fixes dev-tools crashing in subform. Also makes the subform-loading look a bit better by not showing an empty form container.

Added an error boundary inside of the dev tools panel as well, so errors like this are less annoying in the future

Cleaned up dev tools component by removing {children} since we no longer wrap the application in it.

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/* label to this PR for proper release notes grouping
    • I don't have permissions to add labels, please help me out

@bjosttveit bjosttveit added the kind/bug Something isn't working label Dec 12, 2024
@bjosttveit bjosttveit changed the title fix dev tools in subform Fix DevTools in subform Dec 12, 2024
Copy link
Contributor

@olemartinorg olemartinorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 🙌

const hasPresentation = useHasPresentation();

if (overriddenDataModelUuid) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these task-store checks in the loader was something we added to avoid the "page is loading" for each subform during the PDF render.

Have you tested how this now looks during PDF generation?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Also counts for summaries of subforms.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, will check

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The summary table looks good, but in PDF it looks weird indeed. Good catch. What component is used here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of this? As a compromise. Still showing the loader, but not the Presentation around it.

Summary:
image

PDF:
image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless i am missing something @danielskovli

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bjosttveit @olemartinorg Last time I was involved in this part of the code, the ready-for-print mechanism waited for all subform data to finish loading 👌

The Loader modifications were only visual if I remember correctly. Worth noting that the overriddenTaskId check was already in there, I think perhaps @adamhaeger had added it as part of the Summary2 feature.

Copy link
Contributor

@adamhaeger adamhaeger Dec 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overriddenTaskId is (or was?) needed to render summary of a previous task.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the new skeleton loader 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still is, this will just show a loader instead of null while it loads. Due to useHasPresentation it should just show the loader and not the Presentation container around it. In PDF however we don't have any Presentation container, so I added a DummyPresentation that only sets the provider so that loading will not create its own Presentation there either

Copy link

sonarcloud bot commented Dec 13, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
32.0% Coverage on New Code (required ≥ 45%)
0.0% Condition Coverage on New Code (required ≥ 45%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DevTools does not work in subform
4 participants