Skip to content

Save the draft version name and use it in case management title, brea… - #860

Open
sofiaIvarsRitense wants to merge 1 commit into
next-minorfrom
story/395-case-definition-name
Open

Save the draft version name and use it in case management title, brea…#860
sofiaIvarsRitense wants to merge 1 commit into
next-minorfrom
story/395-case-definition-name

Conversation

@sofiaIvarsRitense

@sofiaIvarsRitense sofiaIvarsRitense commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

…dcrumb and menu

Describe the changes

Link to the related Github issue: generiekzaakafhandelcomponent/gzac-issues#395

Specify the code branch location:

Relevant comments:

  1. The draft name is saved
  • Version management → create a draft with a name different from the base version → the new name is saved
  • Create a draft without changing the name → the parent's name is inherited (it does not end up empty)
  1. Page title
  • Shows the name of the selected version, not the Document tab's title
  • Change "title" in the Document tab and save → the Case title does not change
  • Switch versions with the selector → the title follows
  1. Breadcrumb
  • Shows the selected version's name, not the globally active one. Easiest to see on a non-active version with a different name.
  1. Making a version globally active
  • The left menu item changes its name without a reload
  • The set as globally active button becomes disabled for the version you just activated
  • The menu does not collapse: if Cases was expanded, it stays expanded
  1. Menu regressions (the trackBy affects the menu across the whole app)
  • Upload a case definition from the list
  • Expanded/collapsed menu, small and large screens, case counts next to the items
  • Two active cases with the same name: this is why the key is the link and not the title

Breaking changes

  • The contribution only contains changes that are not breaking.

Documentation

  • Release notes have been written for these changes.

New features or changes that have been introduced have been documented.

  • Yes
  • Not applicable

Tests

Unit tests have been added that cover these changes

  • Yes
  • Not applicable

Integration tests have been added that cover these changes

  • Yes
  • Not applicable

Describe the testing steps

  • Step 1
  • Step 2
  • Step 3

Security

The Secure by Design principle has been applied to these changes

  • Yes
  • Not applicable

Added or changed REST API endpoints have authentication and authorization in place

  • Yes
  • Not applicable

Valtimo access control checks have been implemented

  • Yes
  • Not applicable

Dependencies

Newly added dependencies do not introduce known vulnerabilities/CVE's and are in line with the Valtimo license

  • Yes
  • Not applicable

@sofiaIvarsRitense
sofiaIvarsRitense marked this pull request as ready for review July 28, 2026 14:28
@sofiaIvarsRitense
sofiaIvarsRitense requested review from a team as code owners July 28, 2026 14:28
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Draft case definitions now retain the original name when no new name is provided.
    • Case definition names now appear correctly in page titles and breadcrumbs.
    • The case menu and global-active actions update immediately after changes.
    • Expanded menu groups remain open when the menu refreshes.
    • Improved menu rendering stability during navigation updates.

Walkthrough

The backend draft creation path now falls back to the base case definition name when no name is provided, with tests for explicit and fallback names. Case management fetches and exposes the selected case definition for page titles and breadcrumbs, clears breadcrumbs on teardown, caches definition results, and refreshes global-active state and menus after updates. Sidebar menu iterations now use stable tracking keys. Release notes document the related fixes.

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
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 story/395-case-definition-name

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: 4


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 4e18f115-fa55-4c4e-9308-00aec9d96f28

📥 Commits

Reviewing files that changed from the base of the PR and between f2c2e32 and c3a1d05.

📒 Files selected for processing (9)
  • backend/case/src/main/kotlin/com/ritense/case/service/CaseDefinitionService.kt
  • backend/case/src/test/kotlin/com/ritense/case/service/CaseDefinitionServiceTest.kt
  • documentation/release-notes/13.x.x/13.39.0/README.md
  • frontend/projects/valtimo/case-management/src/lib/components/case-management-deployment/case-management-deployment.component.ts
  • frontend/projects/valtimo/case-management/src/lib/components/case-management-detail-actions/case-management-detail-actions.component.ts
  • frontend/projects/valtimo/case-management/src/lib/components/case-management-detail/case-management-detail.component.ts
  • frontend/projects/valtimo/case-management/src/lib/services/case-detail.service.ts
  • frontend/projects/valtimo/components/src/lib/components/left-sidebar/left-sidebar.component.html
  • frontend/projects/valtimo/components/src/lib/components/left-sidebar/left-sidebar.component.ts

Comment on lines +97 to +100
* **Case menu and version indicator now update when a version is made globally active**

Making a version globally active now updates the case menu and the *set as globally active* action immediately.
Previously the menu kept showing the previously active version and its name until the page was reloaded.

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Avoid repeating “previously” in the release note.

The sentence is clearer as “Before this, the menu kept showing the version that had been active and its name until the page was reloaded.”

🧰 Tools
🪛 LanguageTool

[style] ~100-~100: This adverb was used twice in the sentence. Consider removing one of them or replacing them with a synonym.
Context: ... Previously the menu kept showing the previously active version and its name until the p...

(ADVERB_REPETITION_PREMIUM)

Source: Linters/SAST tools

Comment on lines 306 to 309
public ngOnDestroy(): void {
this._subscriptions.unsubscribe();
this.breadcrumbService.clearThirdBreadcrumb();
}

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Do not clear the shared breadcrumb from the deployment child.

CaseManagementDetailComponent also owns and sets the same third breadcrumb. When deployment is a child tab, leaving it destroys this component but leaves the parent mounted; this teardown then removes the parent’s breadcrumb, which is not re-emitted until the case definition changes.

Let the parent own breadcrumb cleanup, or scope cleanup to the route that owns the breadcrumb.

Comment on lines +90 to +94
public readonly globalActiveVersion$: Observable<string | null> = combineLatest([
this.caseDefinitionKey$,
this._refreshGlobalActiveCase$,
]).pipe(
switchMap(([caseDefinitionKey]) =>

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.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Keep the global-active refresh stream alive for null responses.

The inner pipeline can emit null through catchError(() => of(null)), but the following mapping dereferences result.caseDefinitionVersionTag. A failed refresh or no-active-version response will throw and permanently terminate globalActiveVersion$, leaving the active-version indicator and button state stale.

Suggested fix
     switchMap(([caseDefinitionKey]) =>
-      this.caseManagementService.getGlobalActiveCase(caseDefinitionKey).pipe(
-        map(result => result.caseDefinitionVersionTag),
+      this.caseManagementService.getGlobalActiveCase(caseDefinitionKey).pipe(
+        map(result => result?.caseDefinitionVersionTag ?? null),
         catchError(() => of(null))
       )
     )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public readonly globalActiveVersion$: Observable<string | null> = combineLatest([
this.caseDefinitionKey$,
this._refreshGlobalActiveCase$,
]).pipe(
switchMap(([caseDefinitionKey]) =>
switchMap(([caseDefinitionKey]) =>
this.caseManagementService.getGlobalActiveCase(caseDefinitionKey).pipe(
map(result => result?.caseDefinitionVersionTag ?? null),
catchError(() => of(null))
)
)

Comment on lines +156 to +169
private openBreadcrumbSubscription(): void {
this._subscriptions.add(
this.caseDetailService.caseDefinition$.subscribe(caseDefinition => {
if (!caseDefinition) return;

const route = `/case-management/case/${caseDefinition.caseDefinitionKey}/version/${caseDefinition.caseDefinitionVersionTag}`;

this.breadcrumbService.setThirdBreadcrumb({
route: [route],
content: caseDefinition.name,
href: route,
});
})
);

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Clear the breadcrumb when the case-definition lookup returns null.

CaseDetailService maps lookup failures to null, but this handler returns without clearing the existing third breadcrumb. A failed load or version switch can therefore leave the previous version’s name and URL visible.

Suggested fix
       this.caseDetailService.caseDefinition$.subscribe(caseDefinition => {
-        if (!caseDefinition) return;
+        if (!caseDefinition) {
+          this.breadcrumbService.clearThirdBreadcrumb();
+          return;
+        }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private openBreadcrumbSubscription(): void {
this._subscriptions.add(
this.caseDetailService.caseDefinition$.subscribe(caseDefinition => {
if (!caseDefinition) return;
const route = `/case-management/case/${caseDefinition.caseDefinitionKey}/version/${caseDefinition.caseDefinitionVersionTag}`;
this.breadcrumbService.setThirdBreadcrumb({
route: [route],
content: caseDefinition.name,
href: route,
});
})
);
private openBreadcrumbSubscription(): void {
this._subscriptions.add(
this.caseDetailService.caseDefinition$.subscribe(caseDefinition => {
if (!caseDefinition) {
this.breadcrumbService.clearThirdBreadcrumb();
return;
}
const route = `/case-management/case/${caseDefinition.caseDefinitionKey}/version/${caseDefinition.caseDefinitionVersionTag}`;
this.breadcrumbService.setThirdBreadcrumb({
route: [route],
content: caseDefinition.name,
href: route,
});
})
);

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.

1 participant