fix: remove extra edit button#4183
Conversation
📝 WalkthroughWalkthrough
ChangesEditButton Conditional Rendering
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/layout/FileUpload/AttachmentSummaryComponent2.tsx (1)
62-67: 💤 Low valueReuse the already-computed
isEmptyat line 69.Line 69 repeats
filteredAttachments.length === 0whileisEmpty(defined at line 37) already captures the same expression. Consider using it for consistency.♻️ Proposed refactor
- {filteredAttachments.length === 0 ? ( + {isEmpty ? (Also applies to: 69-69
🤖 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/layout/FileUpload/AttachmentSummaryComponent2.tsx` around lines 62 - 67, The code repeats the same emptiness check; replace the direct expression filteredAttachments.length === 0 with the already-computed isEmpty boolean to keep consistency and avoid duplicate logic. Locate the conditional in AttachmentSummaryComponent2 where filteredAttachments.length === 0 is used and change it to use isEmpty, keeping the surrounding JSX (e.g., the EditButton with className={classes.summaryEditButton} and targetBaseComponentId={targetBaseComponentId}) unchanged.
🤖 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.
Nitpick comments:
In `@src/layout/FileUpload/AttachmentSummaryComponent2.tsx`:
- Around line 62-67: The code repeats the same emptiness check; replace the
direct expression filteredAttachments.length === 0 with the already-computed
isEmpty boolean to keep consistency and avoid duplicate logic. Locate the
conditional in AttachmentSummaryComponent2 where filteredAttachments.length ===
0 is used and change it to use isEmpty, keeping the surrounding JSX (e.g., the
EditButton with className={classes.summaryEditButton} and
targetBaseComponentId={targetBaseComponentId}) unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: fb852a63-15d6-45af-87e3-a78160853a12
📒 Files selected for processing (1)
src/layout/FileUpload/AttachmentSummaryComponent2.tsx
|
JamalAlabdullah
left a comment
There was a problem hiding this comment.
Tested and works nice 👍 , you can merge when all test are green
|
✅ Automatic backport successful! A backport PR has been automatically created for the The release branch The cherry-pick was clean with no conflicts. Please review the backport PR when it appears. |
Co-authored-by: walldenfilippa <filippa.walden@digdir.no>



Description
Removes the extra edit button.
The FileUploadComponents in the summary render an Edit button per row, as well as an Edit button in the header. It should only show the Edit button next to the header when no attachments exist. I have added an isEmpty condition to control the rendering of the header Edit button.
Related Issue(s)
Verification/QA
kind/*andbackport*label to this PR for proper release notes groupingSummary by CodeRabbit