Skip to content

Comments

fix: fixed displaying of total row#4012

Open
JamalAlabdullah wants to merge 5 commits intomainfrom
16905-rowsafter-kommer-ikke-med-i-summary2-komponenten-når-man-refererer-til-side

Hidden character warning

The head ref may contain hidden characters: "16905-rowsafter-kommer-ikke-med-i-summary2-komponenten-n\u00e5r-man-refererer-til-side"
Open

fix: fixed displaying of total row#4012
JamalAlabdullah wants to merge 5 commits intomainfrom
16905-rowsafter-kommer-ikke-med-i-summary2-komponenten-når-man-refererer-til-side

Conversation

@JamalAlabdullah
Copy link
Contributor

@JamalAlabdullah JamalAlabdullah commented Feb 23, 2026

Description

Related Issue(s)

After;

Screen.Recording.2026-02-23.at.07.52.31.mov

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

Summary by CodeRabbit

  • New Features

    • Repeating group tables can optionally include summary rows after the main data to show totals and aggregate values.
    • Summary cells (e.g., "summary.total") are rendered when summary rows are enabled for clearer table summaries.
  • Tests

    • Added tests to verify summary-row rendering and total display when summary rows are enabled.

@JamalAlabdullah JamalAlabdullah added kind/bug Something isn't working backport-ignore This PR is a new feature and should not be cherry-picked onto release branches labels Feb 23, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 23, 2026

No actionable comments were generated in the recent review. 🎉


ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0b13046 and 3e638fa.

📒 Files selected for processing (1)
  • src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.tsx

📝 Walkthrough

Walkthrough

Adds support for rendering RepeatingGroup "rowsAfter" summary rows in Summary2 by propagating and rendering rowsAfter entries; updates tests to exercise this via an optional test helper parameter.

Changes

Cohort / File(s) Summary
Repeating Group Table Summary — implementation
src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.tsx
Destructures a new rowsAfter property from useItemWhenType and renders each rowsAfter entry as additional Table.Row items after the main rows; filters cells by hidden columns, renders Lang or ComponentSummary cells, and appends an optional empty Table.Cell when not in PDF mode.
Repeating Group Table Summary — tests
src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.test.tsx
Adds an optional withRowsAfter parameter to the local test helper layoutWithHidden and a new test that sets withRowsAfter to assert that summary.total is rendered in the summary table.
Utility / types impact
src/utils/layout/useNodeItem (signature change reflected in call sites)
useItemWhenType (or equivalent useNodeItem) now exposes rowsAfter alongside existing bindings; callers updated to accept and propagate it.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: fixed displaying of total row' accurately describes the main change in the PR—fixing the display of the rowsAfter-generated total row in the summary2 component.
Description check ✅ Passed The PR description follows the template, includes the related issue link, and documents manual testing and unit test updates. The verification/QA section is properly filled with checkmarks indicating completed actions.
Linked Issues check ✅ Passed The code changes successfully implement the objective from issue #16905: the modifications add propagation of rowsAfter from the layout hook and extend rendering in RepeatingGroupTableSummary.tsx to include rowsAfter content, directly addressing the missing summary/total row in summary2 components.
Out of Scope Changes check ✅ Passed All code changes are focused on the rowsAfter rendering functionality in the RepeatingGroupTableSummary component and its test file. No unrelated or out-of-scope modifications are present beyond the stated objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 16905-rowsafter-kommer-ikke-med-i-summary2-komponenten-når-man-refererer-til-side

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.tsx (1)

96-99: cell.text !== undefined may be redundant after 'text' in cell narrows the type.

If the text property on the cell variant is typed as string (non-optional), the !== undefined guard is always true once 'text' in cell passes and adds noise. Worth confirming against the type definition.

#!/bin/bash
# Locate the type definition for rowsAfter cell to check if `text` is optional
rg -n --type=ts "text\??\s*:" --glob '*/RepeatingGroup*' -A2 -B2
rg -n --type=ts "rowsAfter" -A5 -B2
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.tsx`
around lines 96 - 99, The extra !== undefined check after 'text' in cell is
likely redundant; inspect the cell/rowsAfter type used by
RepeatingGroupTableSummary to confirm whether the text property is declared
optional; if text is non-optional then remove the "&& cell.text !== undefined"
from the Lang render line (leaving {cell && 'text' in cell && <Lang
id={cell.text} />), otherwise if the type is optional keep the explicit
undefined check or prefer a nullish check (cell.text != null) to be explicit;
update the RepeatingGroupTableSummary component accordingly (referencing the
cell variable and the Lang and ComponentSummary render branches).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.test.tsx`:
- Around line 35-41: The test's rowsAfter fixture has three cells but the
rendered table columns (tableHeaders: ['input3']) only expect one data cell plus
an edit column; update the rowsAfter entry in
RepeatingGroupTableSummary.test.tsx to provide a single data cell (e.g., cells:
[{ text: 'summary.total' }]) so it matches the component (which appends the
extra edit cell when !pdfModeActive), and change the assertion to only check for
'summary.total' in the rendered output; reference the withRowsAfter/rowsAfter
test data and pdfModeActive behavior in the RepeatingGroupTableSummary component
when making this change.

In
`@src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.tsx`:
- Around line 92-103: rowsAfter rows rendered in RepeatingGroupTableSummary are
missing the extra trailing Table.Cell that DataRow always adds for the edit
button when pdfModeActive is false, causing column misalignment; update the
rowsAfter mapping in RepeatingGroupTableSummary (the block that maps rowsAfter
to Table.Row/Table.Cell) to append one additional empty <Table.Cell> when
pdfModeActive is false (match the same conditional used by DataRow/visibleIds
logic) so each rowsAfter row has visibleIds.length + 1 cells and aligns with the
header and DataRow entries.

---

Nitpick comments:
In
`@src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.tsx`:
- Around line 96-99: The extra !== undefined check after 'text' in cell is
likely redundant; inspect the cell/rowsAfter type used by
RepeatingGroupTableSummary to confirm whether the text property is declared
optional; if text is non-optional then remove the "&& cell.text !== undefined"
from the Lang render line (leaving {cell && 'text' in cell && <Lang
id={cell.text} />), otherwise if the type is optional keep the explicit
undefined check or prefer a nullish check (cell.text != null) to be explicit;
update the RepeatingGroupTableSummary component accordingly (referencing the
cell variable and the Lang and ComponentSummary render branches).

@JamalAlabdullah JamalAlabdullah moved this to 🔎 In review in Team Altinn Studio Feb 23, 2026
@JamalAlabdullah JamalAlabdullah added the squad/utforming Issues that belongs to the named squad. label Feb 23, 2026
@JamalAlabdullah JamalAlabdullah moved this from 🔎 In review to 👷 In progress in Team Altinn Studio Feb 23, 2026
@JamalAlabdullah JamalAlabdullah moved this from 👷 In progress to 🔎 In review in Team Altinn Studio Feb 23, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3fbc364 and 5eac44e.

📒 Files selected for processing (2)
  • src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.test.tsx
  • src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.test.tsx
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.tsx`:
- Around line 92-104: rowsAfter rows currently render every entry in row.cells
and can produce a different cell count than DataRow (which only renders
visibleIds based on columnSettings[id]?.hidden), causing misalignment; update
the rowsAfter rendering in RepeatingGroupTableSummary to filter row.cells the
same way DataRow does—either map visibleIds to pick the corresponding cell
entries (using the same visibleIds and columnSettings logic) or apply the
hiddenColumnIndices approach used by GridRowsRenderer/GridRowRenderer so
rowsAfter outputs exactly visibleIds.length cells (plus the extra cell when
!pdfModeActive).

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.tsx (1)

95-110: Previous hidden-column alignment concern is now resolved; trailing-cell condition correctly mirrors the header.

The hiddenColumnIndices filter ensures rowsAfter produces the same cell count as the visible columns, addressing the mismatch flagged in the prior review. The empty tail-cell condition !pdfModeActive && !isSmall (line 108) correctly matches the header's condition (line 71) rather than DataRow's !pdfModeActive — appropriate since rowsAfter carries no edit action.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.tsx`
around lines 95 - 110, The previous alignment issue is resolved: ensure no code
changes are needed — keep the filtering on rowsAfter using hiddenColumnIndices
and preserve the trailing empty cell condition using !pdfModeActive && !isSmall
so RepeatingGroupTableSummary (rowsAfter rendering) matches the header behavior;
verify the logic around rowsAfter, hiddenColumnIndices, pdfModeActive and
isSmall remains as shown and do not revert to DataRow's !pdfModeActive
condition.
ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5eac44e and 0b13046.

📒 Files selected for processing (1)
  • src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.tsx
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In
`@src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.tsx`:
- Around line 95-110: The previous alignment issue is resolved: ensure no code
changes are needed — keep the filtering on rowsAfter using hiddenColumnIndices
and preserve the trailing empty cell condition using !pdfModeActive && !isSmall
so RepeatingGroupTableSummary (rowsAfter rendering) matches the header behavior;
verify the logic around rowsAfter, hiddenColumnIndices, pdfModeActive and
isSmall remains as shown and do not revert to DataRow's !pdfModeActive
condition.

Copy link
Contributor

@Magnusrm Magnusrm left a comment

Choose a reason for hiding this comment

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

🥳

@JamalAlabdullah JamalAlabdullah moved this from 🔎 In review to 🧪 Test in Team Altinn Studio Feb 23, 2026
…r-ikke-med-i-summary2-komponenten-når-man-refererer-til-side
@sonarqubecloud
Copy link

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/bug Something isn't working squad/utforming Issues that belongs to the named squad.

Projects

Status: 🧪 Test

Development

Successfully merging this pull request may close these issues.

rowsAfter kommer ikke med i summary2-komponenten når man refererer til side.

2 participants