Skip to content

Vis pakker bruker ikke har ved søk på brukersiden - #2406

Merged
mgunnerud merged 8 commits into
mainfrom
3393-brukersiden-kunne-soke-etter-pakker-du-ikke-har-uten-modal
Jul 28, 2026
Merged

Vis pakker bruker ikke har ved søk på brukersiden#2406
mgunnerud merged 8 commits into
mainfrom
3393-brukersiden-kunne-soke-etter-pakker-du-ikke-har-uten-modal

Conversation

@mgunnerud

@mgunnerud mgunnerud commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Description

  • Ved søk i tilgangspakker på brukersiden, vis pakker som matcher søket også i områder der brukeren ikke har pakker fra før
  • Dette gjelder også søk i tilgangspakker for brukere på "Fullmakter hos andre"-siden
  • "Andre treff"-seksjonen vises kun dersom det er et eller flere treff. "Treff i aktive fullmakter" vises alltid, med egen melding hvis det ikke er treff i noen aktive fullmakter
image image image

Related Issue(s)

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)
  • All tests run green

Documentation

  • User documentation is updated with a separate linked PR in altinn-studio-docs. (if applicable)

Summary by CodeRabbit

  • New Features
    • Added an option to show unassigned available areas, presenting results as “active matches” and “other matches” with headings and a divider.
    • Updated the user rights access package section so the split view is controlled by the current search input.
    • Added localized search result labels for active matches, no active matches, and other matches (English and Norwegian).
  • Bug Fixes
    • Improved result accuracy by filtering assignable packages by the area’s party type.
    • Refined empty/no-matching-search states so the correct “no packages” messaging is shown reliably.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@mgunnerud, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 34 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 96c72024-9e34-4333-a9a3-95e58ab084cc

📥 Commits

Reviewing files that changed from the base of the PR and between e8f60ea and 7b4aceb.

📒 Files selected for processing (1)
  • src/features/amUI/common/AccessPackageList/AreaItem.tsx
📝 Walkthrough

Walkthrough

Search mode now filters available packages by party type and displays assigned and unassigned areas in separate localized sections. AccessPackageList adds grouped rendering, heading support, dividers, and simplified empty-state handling.

Changes

Access package search results

Layer / File(s) Summary
Party-type filtering
src/features/amUI/common/AccessPackageList/useAreaPackageList.ts
Area type matching is title-cased, assignable packages are restricted to matching party types, memoization tracks the type filter, and the unused partyType result field is removed.
Grouped list rendering and heading support
src/features/amUI/common/AccessPackageList/AccessPackageList.tsx, src/features/amUI/common/AccessPackageList/AreaItem.tsx, src/features/amUI/common/AccessPackageList/AreaItemContent.tsx, src/features/amUI/common/AccessPackageList/AccessPackageList.module.css, src/features/amUI/poaOverview/*.tsx, src/localizations/*.json
Search results render assigned and unassigned areas in separate sections with headings, dividers, empty states, reusable list rendering, updated heading levels, and localized labels.
Search mode wiring
src/features/amUI/userRightsPage/AccessPackageSection/ActiveDelegations.tsx
Search input enables all-area and unassigned-area display modes.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ActiveDelegations
  participant AccessPackageList
  participant useAreaPackageList
  ActiveDelegations->>AccessPackageList: enable search display modes
  AccessPackageList->>useAreaPackageList: request area package results
  useAreaPackageList-->>AccessPackageList: return filtered matching areas
  AccessPackageList-->>ActiveDelegations: render localized grouped results
Loading

Suggested labels: kind/feature-request

Suggested reviewers: sonwit, allinox

Poem

Areas gather, packages align,
Active matches clearly shine.
Others wait beyond the line,
Search lights up the access trail.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Tittelen beskriver hovedendringen: å vise pakker brukeren ikke har ved søk på brukersiden.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 3393-brukersiden-kunne-soke-etter-pakker-du-ikke-har-uten-modal

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/features/amUI/common/AccessPackageList/AccessPackageList.tsx (1)

157-158: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Confusing variable naming: "assignable" vs "unassignable" reads backwards here.

areasAssignablePackages holds areas that already have an assigned/matched package, while areasUnassignablePackages holds areas that don't. That's the opposite of what "assignable"/"unassignable" typically implies (available-to-assign vs not), which risks future misreads.

♻️ Suggested rename
-  const areasAssignablePackages = combinedAreas.filter((x) => x.packages.assigned.length > 0);
-  const areasUnassignablePackages = combinedAreas.filter((x) => x.packages.assigned.length === 0);
+  const areasWithActiveMatches = combinedAreas.filter((x) => x.packages.assigned.length > 0);
+  const areasWithoutActiveMatches = combinedAreas.filter((x) => x.packages.assigned.length === 0);

(and update the corresponding usages below)

🤖 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/amUI/common/AccessPackageList/AccessPackageList.tsx` around
lines 157 - 158, Rename areasAssignablePackages and its corresponding usages to
reflect that these areas already have assigned packages, and rename
areasUnassignablePackages and all usages to reflect that these areas have no
assigned packages; preserve the existing filter conditions and behavior.
🤖 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.

Inline comments:
In `@src/features/amUI/common/AccessPackageList/useAreaPackageList.ts`:
- Around line 153-159: Update the showAllAreas filtering in useAreaPackageList
to compare area.typeName with the same Person/Organization values used by
AccessPackageList rather than Norwegian labels, and only apply the party-type
predicate when filterByType is enabled. Include filterByType in the useMemo
dependency array so memoized results update correctly.

---

Nitpick comments:
In `@src/features/amUI/common/AccessPackageList/AccessPackageList.tsx`:
- Around line 157-158: Rename areasAssignablePackages and its corresponding
usages to reflect that these areas already have assigned packages, and rename
areasUnassignablePackages and all usages to reflect that these areas have no
assigned packages; preserve the existing filter conditions and behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 05d037bf-f8a4-461f-a986-de76a164b106

📥 Commits

Reviewing files that changed from the base of the PR and between 9c99116 and b4f436d.

📒 Files selected for processing (7)
  • src/features/amUI/common/AccessPackageList/AccessPackageList.module.css
  • src/features/amUI/common/AccessPackageList/AccessPackageList.tsx
  • src/features/amUI/common/AccessPackageList/useAreaPackageList.ts
  • src/features/amUI/userRightsPage/AccessPackageSection/ActiveDelegations.tsx
  • src/localizations/en.json
  • src/localizations/no_nb.json
  • src/localizations/no_nn.json

Comment thread src/features/amUI/common/AccessPackageList/useAreaPackageList.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@src/features/amUI/common/AccessPackageList/useAreaPackageList.ts`:
- Around line 55-58: Align the organization type value in the typeName mapping
with the canonical area value by using “Organization” instead of “Organisasjon”.
Update the post-query filtering logic around the useMemo at lines 154–183 so it
only filters by party type when filterByType is true, and add filterByType to
that useMemo’s dependency array.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a800776d-39b2-47f2-8de4-3b64a5512414

📥 Commits

Reviewing files that changed from the base of the PR and between b4f436d and 86eed73.

📒 Files selected for processing (1)
  • src/features/amUI/common/AccessPackageList/useAreaPackageList.ts

Comment thread src/features/amUI/common/AccessPackageList/useAreaPackageList.ts
@mgunnerud
mgunnerud requested a review from sonwit July 27, 2026 09:48

@sonwit sonwit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Funker bra! 👍🏼

Comment thread src/features/amUI/common/AccessPackageList/AccessPackageList.tsx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/features/amUI/common/AccessPackageList/AccessPackageList.tsx (1)

204-225: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Preserve the grouped empty state for searches.

When showUnassignedAvailableAreas is enabled and a search returns no areas, these early returns bypass Treff i aktive fullmakter: and its dedicated empty message. Keep the generic no-match/no-packages returns for ungrouped lists only, or let the grouped renderer handle empty search results.

Proposed fix
+  const isGroupedSearch = showUnassignedAvailableAreas && Boolean(searchString);
+
   if (
     searchString &&
     searchString.length > 0 &&
+    !isGroupedSearch &&
     (allPackageAreas === undefined || allPackageAreas.length === 0 || displayAreas.length === 0)
   ) {
...
-  if (displayAreas.length === 0 && !searchError && !activeDelegationsError) {
+  if (displayAreas.length === 0 && !isGroupedSearch && !searchError && !activeDelegationsError) {
🤖 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/amUI/common/AccessPackageList/AccessPackageList.tsx` around
lines 204 - 225, Update the early empty-state returns in the AccessPackageList
render flow so they apply only to ungrouped lists when
showUnassignedAvailableAreas is disabled. When grouped rendering is enabled,
allow empty search results to reach the grouped renderer so it preserves “Treff
i aktive fullmakter:” and its dedicated empty message.
🤖 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.

Inline comments:
In `@src/features/amUI/common/AccessPackageList/AreaItem.tsx`:
- Line 70: Update the titleAs construction in AreaItem so an omitted
headingLevel defaults to 3 before interpolation, preserving the existing h3
fallback while retaining explicitly provided heading levels.

---

Outside diff comments:
In `@src/features/amUI/common/AccessPackageList/AccessPackageList.tsx`:
- Around line 204-225: Update the early empty-state returns in the
AccessPackageList render flow so they apply only to ungrouped lists when
showUnassignedAvailableAreas is disabled. When grouped rendering is enabled,
allow empty search results to reach the grouped renderer so it preserves “Treff
i aktive fullmakter:” and its dedicated empty message.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: dd94680c-3f94-4515-82d4-6e4141194730

📥 Commits

Reviewing files that changed from the base of the PR and between 213acd2 and e8f60ea.

📒 Files selected for processing (5)
  • src/features/amUI/common/AccessPackageList/AccessPackageList.tsx
  • src/features/amUI/common/AccessPackageList/AreaItem.tsx
  • src/features/amUI/common/AccessPackageList/AreaItemContent.tsx
  • src/features/amUI/poaOverview/AccessPackagePermissions.tsx
  • src/features/amUI/poaOverview/GuardianshipPermissions.tsx

Comment thread src/features/amUI/common/AccessPackageList/AreaItem.tsx
@mgunnerud
mgunnerud merged commit f32adac into main Jul 28, 2026
5 checks passed
@mgunnerud
mgunnerud deleted the 3393-brukersiden-kunne-soke-etter-pakker-du-ikke-har-uten-modal branch July 28, 2026 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Brukersiden: Kunne søke etter pakker du ikke har uten modal

2 participants