@@ -59,10 +59,10 @@ The following Guard requires both sign-in and terms acceptance before entering
5959import type { ActivityGuardFor } from " @stackflow/plugin-activity-guard" ;
6060import { all , redirect } from " @stackflow/plugin-activity-guard" ;
6161
62- const requireSignIn: ActivityGuardFor <" Checkout" > = ({ activityParams }) =>
62+ const requireSignIn: ActivityGuardFor <" Checkout" > = ({ activityName , activityParams }) =>
6363 isSignedIn ()
6464 ? true
65- : redirect (" SignIn" , { returnTo: activityParams . orderId });
65+ : redirect (" SignIn" , { returnTo: { activityName , activityParams } });
6666
6767const requireTerms: ActivityGuardFor <" Checkout" > = ({ activityParams }) =>
6868 hasAcceptedTerms ()
@@ -79,12 +79,9 @@ Each Guard receives the requested `activityName` and its typed
7979
8080## Behavior and limitations
8181
82- - Activities without a registered Guard are allowed.
8382- Redirect destinations are guarded again. Redirect chains must eventually
8483 reach an allowed or unguarded Activity; redirect cycles are not detected.
85- - Guards run synchronously. If a Guard throws, the error is propagated and the
86- requested ` push ` or ` replace ` is not dispatched. An error during initial
87- entry aborts Stack creation.
84+ - Guards must not throw any errors.
8885- A redirect preserves whether the original operation was a ` push ` or
8986 ` replace ` , along with its other action parameters.
9087- Guards run for fresh initial navigation, but not when Stackflow restores a
0 commit comments