Merged PR 2042: fix(navigation): prevent autoTriggerContinueFn from persisting across navigat...

fix(navigation): prevent autoTriggerContinueFn from persisting across navigations

The autoTriggerContinueFn flag was remaining in navigation context after
being read, causing incorrect auto-triggering on subsequent page visits.

Changes:
- Add patchContext() method to NavigationContextService and NavigationStateService
  for partial context updates without full replacement
- Update details-main-view.component to use patchContext() to clear the flag
  immediately after reading, while preserving returnUrl
- Add comprehensive JSDoc and README documentation for patchContext()
- Include structured logging for patch operations

The new patchContext() method provides a cleaner API for updating specific
context properties without manually preserving all other properties.

Closes #5500

Related work items: #5500
This commit is contained in:
Lorenz Hilpert
2025-11-21 13:45:40 +00:00
committed by Nino Righi
parent 7a6a2dc49d
commit bf87df6273
4 changed files with 182 additions and 0 deletions

View File

@@ -329,6 +329,12 @@ export class CustomerDetailsViewMainComponent
}>('select-customer');
if (context?.autoTriggerContinueFn) {
// Clear the autoTriggerContinueFn flag immediately (preserves returnUrl automatically)
await this._navigationState.patchContext(
{ autoTriggerContinueFn: undefined },
'select-customer',
);
// Auto-trigger continue() ONLY when coming from Kundenkarte
this.continue();
}