@coolon/angular-ui-powerups 16.1.0-alpha.271 → 16.1.0-alpha.273

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,6 +18,16 @@ export declare class PlaceGuard {
18
18
  constructor(router: Router, urlService: UrlService, placeRouter: PlaceRouter, placeHistory: PlaceHistory, interactionService: InteractionService, injector: Injector);
19
19
  get authService(): PlaceAuthService;
20
20
  canActivate(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree>;
21
+ /**
22
+ * Whether this guard pass should append a child segment to the url.
23
+ *
24
+ * For a route-id place the redirect must wait until the id is RESOLVED: an empty id followed by
25
+ * a child is unrepresentable in the url (it serialises as `//`, which Angular's parser silently
26
+ * truncates at). The check reads the SANITISED visit — the post-remember/default/sanitiser
27
+ * truth — so a sanitiser-supplied id redirects on the corrected-url pass, and an id supplied
28
+ * later (e.g. a selection model's auto-selection) redirects on that navigation's guard run.
29
+ */
30
+ private shouldRedirectToChild;
21
31
  /**
22
32
  * Chooses the child to redirect to when {@link PlaceDefinition.redirectToFirstChild} is set. When
23
33
  * `rememberLastChild` is enabled (the default) and we have a record of the last active child that is
@@ -7,6 +7,13 @@ export interface NavigationContext {
7
7
  readonly urlService: UrlService;
8
8
  readonly routerInteractionAdapter: InteractionServiceRoutingAdapter;
9
9
  finishRoutingSession(visit?: Visit): any;
10
+ /**
11
+ * Records a completed navigation's visit (active visit + place history) WITHOUT finishing the
12
+ * session — for sessions that hand over to housekeeping (e.g. the interaction-id sync) whose own
13
+ * finish is deliberately visitless. Dropping the visit instead leaves activeVisit$ stale, and a
14
+ * later navigate() then builds its url from stale (possibly id-less) segments.
15
+ */
16
+ recordVisit(visit: Visit): any;
10
17
  transitionTo(newState: NavigationSession): any;
11
18
  navigateByUrl(urlSnapshot: UrlSnapshot, options: {
12
19
  replaceUrl: boolean;
@@ -21,8 +28,9 @@ export declare namespace NavigationContext {
21
28
  }) => Promise<boolean>;
22
29
  readonly transitionTo: (newState: NavigationSession) => void;
23
30
  readonly finishRoutingSession: (visit?: Visit) => void;
31
+ readonly recordVisit: (visit: Visit) => void;
24
32
  constructor(urlService: UrlService, routerInteractionAdapter: InteractionServiceRoutingAdapter, navigateByUrl: (urlSnapshot: UrlSnapshot, options: {
25
33
  replaceUrl: boolean;
26
- }) => Promise<boolean>, transitionTo: (newState: NavigationSession) => void, finishRoutingSession: (visit?: Visit) => void);
34
+ }) => Promise<boolean>, transitionTo: (newState: NavigationSession) => void, finishRoutingSession: (visit?: Visit) => void, recordVisit: (visit: Visit) => void);
27
35
  }
28
36
  }
@@ -24,9 +24,9 @@ export declare abstract class NavigationSession extends GarbageCollector {
24
24
  get isInteractionSync(): boolean;
25
25
  /**
26
26
  * Interruptible sessions are internal housekeeping navigations (e.g. interaction-id
27
- * synchronisation) that a real user- or model-driven navigation is allowed to queue behind
28
- * and supersede, rather than being rejected. Real navigations (Navigating, PopState) are not
29
- * interruptible.
27
+ * synchronisation). Historically only these queued an overlapping navigation while real
28
+ * navigations dropped it; ALL overlapping navigations now queue (see
29
+ * PlaceRouter.handleOverlappingNavigation), so this flag is diagnostic only.
30
30
  */
31
31
  get isInterruptible(): boolean;
32
32
  get name(): string;
@@ -61,15 +61,18 @@ export declare class PlaceRouter extends GarbageCollector {
61
61
  navigate(placeComponent: Constructable<PlaceComponent>, params?: Record<string, unknown>): any;
62
62
  doNavigation(visit: Visit, runNavigationCommands: (router: Router) => unknown): Promise<void>;
63
63
  /**
64
- * Handles a navigation triggered while another is already in flight.
64
+ * Handles a navigation triggered while another is already in flight: queue it (coalescing to the
65
+ * latest) and run it once the in-flight session finishes.
65
66
  *
66
- * This used to throw `illegalState('Navigation already in progress')`, which killed the
67
- * triggering action - occasionally seen in production when a user click collided with an
68
- * in-flight interaction-id sync. Instead we warn with diagnostic context and decide based on the
69
- * in-progress session:
70
- * - interruptible session in progress (internal housekeeping, e.g. interaction-id sync) -> queue
71
- * the incoming navigation and run it once the current session finishes (coalescing to latest).
72
- * - real navigation in progress -> keep it and drop the incoming one (logging full context).
67
+ * History: this used to throw `illegalState('Navigation already in progress')` (killed the
68
+ * triggering action), then dropped real-vs-real collisions as an interim policy pending
69
+ * production evidence. The evidence arrived: a `navigate()` issued from `onPlaceReady` or a
70
+ * route-parameter subscription can land while the activating navigation's session is still
71
+ * settling — dropping it leaves a place that never finishes navigating (e.g. a
72
+ * redirectToFirstChild-style child that never appears), and the caller can't tell because the
73
+ * dropped promise resolved normally. Popstate never enters doNavigation (it arrives via router
74
+ * events -> onPopState), so queueing programmatic navigations behind an in-flight session
75
+ * preserves user-intent ordering.
73
76
  */
74
77
  private handleOverlappingNavigation;
75
78
  private queueNavigation;
@@ -81,6 +84,17 @@ export declare class PlaceRouter extends GarbageCollector {
81
84
  private createNavigationSession;
82
85
  protected transitionTo(next: NavigationSession): void;
83
86
  private routingSessionFinished;
87
+ /**
88
+ * Records a completed navigation's visit without finishing the session. Shared by the normal
89
+ * finish path and sessions that hand over to visitless housekeeping (see
90
+ * NavigationContext.recordVisit).
91
+ */
92
+ private recordFinishedVisit;
93
+ /**
94
+ * Runs `func` when the NEXT navigation session finishes — which may be a session that hasn't
95
+ * started yet (the interaction-id sync registers its completion job before starting the sync
96
+ * session, and jobs registered while a drain is running belong to the following session).
97
+ */
84
98
  private runAfterRoutingSessionFinishes;
85
99
  /**
86
100
  * Sync's the current interaction state with the URL. We need to push something in the URL in order
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coolon/angular-ui-powerups",
3
- "version": "16.1.0-alpha.271",
3
+ "version": "16.1.0-alpha.273",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "^16.2.9",
6
6
  "@angular/common": "^16.2.9",
@@ -12,7 +12,7 @@
12
12
  "@angular/platform-browser-dynamic": "^16.2.9",
13
13
  "@angular/material-moment-adapter": "^16.2.10",
14
14
  "@angular/router": "^16.2.9",
15
- "@coolon/pectin": "^5.0.0-alpha.137",
15
+ "@coolon/pectin": "^5.0.0-alpha.139",
16
16
  "fast-typescript-memoize": "^1.1.1",
17
17
  "lodash-es": "^4.17.21",
18
18
  "marked": "4.0.10",