Skip to content

fix: show receipt when the instance has no data elements left - #4414

Merged
olavsorl merged 1 commit into
mainfrom
fix/receipt-no-data-elements
Nov 19, 2026
Merged

olavsorl merged 1 commit into
mainfrom
fix/receipt-no-data-elements

Conversation

@olavsorl

@olavsorl olavsorl commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Description

The receipt page got stuck on the skeleton loader (reason receipt-missing-attachments) when an instance had no data elements left after the process ended. This happens when every data type, including ref-data-as-pdf and attachments, is configured with appLogic.autoDeleteOnProcessEnd: the backend deletes the elements at process end, Storage hides them from the end user, and the instance is returned with an empty data list.

ReceiptContainer treated an empty data list as "instance not loaded yet" and never rendered the receipt. It now only waits for the instance query to resolve and treats an empty list as "no attachments". Both the full and the simple receipt render as before when attachments or a PDF exist.

For service owners: apps that auto-delete all data types at process end now show the receipt page instead of a never-ending loading state.

image

Slack thread: https://digdir-samarbeid.slack.com/archives/C02EJ9HKQA3/p1794842550350119

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

How it was verified

Two new unit tests in ReceiptContainer.test.tsx render the receipt with an instance whose data list is empty, with and without autoDeleteOnProcessEnd on the instance level. Without the fix both fail after the 15 s wait with Expected to not be loading, but was loading because of 'receipt-missing-attachments'. With the fix all six tests in the file pass. eslint, prettier --check and tsc --noEmit are clean.

Browser verification is not possible in the environment this was developed in, so the service owner should verify in TT02 once released.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Receipts with no remaining data elements now display available attachments instead of getting stuck loading.
    • Receipts without submitted items no longer show the submitted-items heading.
    • Auto-delete receipts with no remaining data elements display the simple receipt view.

When every data type (including ref-data-as-pdf and attachments) is
configured with appLogic.autoDeleteOnProcessEnd, the instance has no
data elements once the process ends. ReceiptContainer treated an empty
data list as "not loaded yet" and rendered the skeleton loader forever
(reason: receipt-missing-attachments). Wait only for the instance query
to resolve, and treat an empty list as no attachments.
@olavsorl olavsorl added kind/bug Something isn't working backport This PR should be cherry-picked onto older release branches labels Nov 17, 2026
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

ReceiptContainer now computes display attachments after an instance loads, including when it has no data elements. Tests cover standard and auto-delete receipts in that state.

Changes: Empty-instance receipt handling

Layer / File(s) Summary
Attachment availability and empty-receipt rendering
src/features/receipt/ReceiptContainer.tsx, src/features/receipt/ReceiptContainer.test.tsx
ReceiptContainer computes display attachments when the instance is loaded, even if it has no data elements. PDF attachments still require data elements. Tests check that standard receipts omit the submitted-items heading and that auto-delete receipts show the simple-receipt message. Both cases assert that no loader remains.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested labels: kind/bug

Suggested reviewers: cammiida, olemartinorg

Merge Risk: Minimal · up to daa8e

The receipt page now renders instead of staying on its loader when an instance has no data elements left. The change is small, covered by new tests, and has no identified merge risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix: show receipt when the instance has no data elements left" matches the main change. ReceiptContainer now shows the receipt when the instance has loaded, even with an empty data list. Th…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description states the problem, cause, and fix clearly. It names the affected code path (ReceiptContainer), the reason code (receipt-missing-attachments), and the expected behavior for service own…
Full details: Title check

Explanation

The title "fix: show receipt when the instance has no data elements left" matches the main change. ReceiptContainer now shows the receipt when the instance has loaded, even with an empty data list. The title is specific and follows the conventional-commit style.

Full details: Description check

Explanation

The description states the problem, cause, and fix clearly. It names the affected code path (ReceiptContainer), the reason code (receipt-missing-attachments), and the expected behavior for service owners. The Verification/QA section is filled in, including unit tests, a note on what failed before the fix, and that lint and type checks pass. It also records that manual verification in TT02 is pending. The template's Related Issue(s) section has no GitHub issue; the author explains this and cites a related discussion (#859). The template requires a closing reference, so a maintainer should confirm the linked issue or discussion is correct. The description has no real gaps that block merge.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 03899e49-5da9-49a9-85f5-f86c93d1ee0c
Commits

Reviewing files that changed from the base of the PR and between fcd6b4c and daa8e9d.

Files selected for processing: 2

  • src/features/receipt/ReceiptContainer.test.tsx
  • src/features/receipt/ReceiptContainer.tsx

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@olavsorl

Copy link
Copy Markdown
Contributor Author

/publish

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR release:

  • <link rel="stylesheet" type="text/css" href="https://altinncdn.no/toolkits/altinn-app-frontend/4.37.0-pr.6091.receipt-no-data-elements.daa8e9dc/altinn-app-frontend.css">
  • <script src="https://altinncdn.no/toolkits/altinn-app-frontend/4.37.0-pr.6091.receipt-no-data-elements.daa8e9dc/altinn-app-frontend.js"></script>

⚙️ Building...
✅ Done!

@olavsorl
olavsorl merged commit 4f558b8 into main Nov 19, 2026
17 of 19 checks passed
@olavsorl
olavsorl deleted the fix/receipt-no-data-elements branch November 19, 2026 13:29
@github-actions

Copy link
Copy Markdown
Contributor

✅ Automatic backport successful!

A backport PR has been automatically created for the release/v4.37 release branch.

The release branch release/v4.37 already existed and was updated.

The cherry-pick was clean with no conflicts. Please review the backport PR when it appears.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR should be cherry-picked onto older release branches kind/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants