feat/18402 hide appName header in pdf#4173
Conversation
📝 WalkthroughWalkthroughAdds a boolean ChangesPDF App Name Hide Flag
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
…s prop hideAppNameInPdf from enum to ExprVal.Boolean
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/features/form/layoutSettings/LayoutSettingsContext.tsx (1)
65-75:⚠️ Potential issue | 🟠 Major | ⚡ Quick win
hideAppNameInPdfis not propagated fromsettings.pagesYou added a default at Line 133, but
processDatanever copiessettings.pages.hideAppNameInPdfintopageSettings. That means page-level configuration is ignored.Suggested fix
pageSettings: omitUndefined({ autoSaveBehavior: settings.pages.autoSaveBehavior, expandedWidth: settings.pages.expandedWidth, hideCloseButton: settings.pages.hideCloseButton, + hideAppNameInPdf: settings.pages.hideAppNameInPdf, navigationTitle: settings.pages.navigationTitle, showExpandWidthButton: settings.pages.showExpandWidthButton, showLanguageSelector: settings.pages.showLanguageSelector, showProgress: settings.pages.showProgress, taskNavigation: settings.pages.taskNavigation?.map((g) => ({ ...g, id: uuidv4() })), validationOnNavigation: settings.pages.validationOnNavigation, }),Also applies to: 133-133
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/features/form/layoutSettings/LayoutSettingsContext.tsx` around lines 65 - 75, processData currently fails to propagate the page-level hideAppNameInPdf because pageSettings (in the object built for processData) omits that property; update the pageSettings mapping inside processData to include hideAppNameInPdf: settings.pages.hideAppNameInPdf so the page-level configuration is copied through (reference: pageSettings, processData, settings.pages.hideAppNameInPdf).
🧹 Nitpick comments (1)
src/features/pdf/PDFWrapper.test.tsx (1)
101-129: ⚡ Quick winUse
renderWithProvidersfor these form-layout-context testsThese new cases exercise
PdfWrapperwith form layout context; please switch them torenderWithProvidersinstead of the custom render path for consistency with project test setup.As per coding guidelines, "Use
renderWithProvidersfromsrc/test/renderWithProviders.tsxwhen testing components that require form layout context".🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/features/pdf/PDFWrapper.test.tsx` around lines 101 - 129, Replace the custom render calls in PDFWrapper.test.tsx for the hideAppNameInPdf suite with the project helper renderWithProviders (imported from src/test/renderWithProviders.tsx) so the tests run with the form layout context; specifically change uses of render(RenderAs.User, {...}) to renderWithProviders(RenderAs.User, {...}) and update the test file imports to import renderWithProviders and remove/replace the old render import, keeping the same options (e.g., fetchLayoutSets) and assertions for `#readyForPrint` and the heading checks.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/features/form/layoutSettings/LayoutSettingsContext.tsx`:
- Around line 65-75: processData currently fails to propagate the page-level
hideAppNameInPdf because pageSettings (in the object built for processData)
omits that property; update the pageSettings mapping inside processData to
include hideAppNameInPdf: settings.pages.hideAppNameInPdf so the page-level
configuration is copied through (reference: pageSettings, processData,
settings.pages.hideAppNameInPdf).
---
Nitpick comments:
In `@src/features/pdf/PDFWrapper.test.tsx`:
- Around line 101-129: Replace the custom render calls in PDFWrapper.test.tsx
for the hideAppNameInPdf suite with the project helper renderWithProviders
(imported from src/test/renderWithProviders.tsx) so the tests run with the form
layout context; specifically change uses of render(RenderAs.User, {...}) to
renderWithProviders(RenderAs.User, {...}) and update the test file imports to
import renderWithProviders and remove/replace the old render import, keeping the
same options (e.g., fetchLayoutSets) and assertions for `#readyForPrint` and the
heading checks.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f150a490-250c-4561-8bcd-fc2a1b290579
📒 Files selected for processing (4)
src/codegen/Common.tssrc/features/form/layoutSettings/LayoutSettingsContext.tsxsrc/features/pdf/PDFWrapper.test.tsxsrc/features/pdf/PdfFromLayout.tsx
|



Description
The
hideAppNameInPdfproperty determines whether the app name is displayed in the PDF header.Footer appName is handled in app-lib: Altinn/app-lib-dotnet#1753
Related Issue(s)
Verification/QA
kind/*andbackport*label to this PR for proper release notes groupingSummary by CodeRabbit
New Features
Tests