From be33feb410a89c672ec78f2ad23247dc7ec45566 Mon Sep 17 00:00:00 2001 From: hborawski Date: Tue, 19 Mar 2024 11:05:05 -0700 Subject: [PATCH 1/3] refactor nav docs slightly to better call out onEnd expressions --- docs/site/pages/content/navigation.mdx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/site/pages/content/navigation.mdx b/docs/site/pages/content/navigation.mdx index 2e0cdc629..25ec44a92 100644 --- a/docs/site/pages/content/navigation.mdx +++ b/docs/site/pages/content/navigation.mdx @@ -94,11 +94,15 @@ The flow state executes the referenced flow, and its `outcome` determines the tr Reaching this state will execute the `FLOW_2` flow -- and if `FLOW_2` reaches an `END` state with an `outcome` of `next`, will transition to the `VIEW_2` state +## Expressions + State types can also contain `onStart` and `onEnd` properties for evaluating expressions. Order of operations: 1. `onStart` - Evaluated at the start of a node's lifecycle; useful for updating data before it's resolved 2. `exp` -3. `onEnd` - Evaluated last, right before transition. If a transition is halted (by validation or otherwise), the expression won't be executed. +3. `onEnd` - Evaluated last, right before transition. + 1. If a transition is halted (by validation or otherwise), the expression won't be executed. + 1. Player navigation is a state machine, `onEnd` expressions will only execute when the state machine ends the flow. Terminating the flow, by unmounting player on any given platform, will not execute `onEnd` expressions, as it would not have reached an `END` state. ## Examples @@ -128,7 +132,7 @@ This is the simplest of flows. The navigation begins with executing `FLOW_1`. `F ![Single Flow Example](/simple-flow.png?darkModeInvert) -### Flow with `onStart` expression +### Flow with `onStart` expression on a `VIEW` state ```json { @@ -153,7 +157,7 @@ This is the simplest of flows. The navigation begins with executing `FLOW_1`. `F The `view` node in this flow utilizes an `onStart` expression to update the `ref` property dynamically. The expression is evaluated before the data is resolved, and the node references the updated `id`. -### Flow with multiple expressions +### Flow with multiple expression types on a `VIEW` state ```json { From 2c34d411645c39bb32696cfa41e4ede95bc879ad Mon Sep 17 00:00:00 2001 From: hborawski Date: Tue, 19 Mar 2024 11:24:55 -0700 Subject: [PATCH 2/3] reword some more --- docs/site/pages/content/navigation.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/site/pages/content/navigation.mdx b/docs/site/pages/content/navigation.mdx index 25ec44a92..680dde11f 100644 --- a/docs/site/pages/content/navigation.mdx +++ b/docs/site/pages/content/navigation.mdx @@ -101,8 +101,8 @@ State types can also contain `onStart` and `onEnd` properties for evaluating exp 1. `onStart` - Evaluated at the start of a node's lifecycle; useful for updating data before it's resolved 2. `exp` 3. `onEnd` - Evaluated last, right before transition. - 1. If a transition is halted (by validation or otherwise), the expression won't be executed. - 1. Player navigation is a state machine, `onEnd` expressions will only execute when the state machine ends the flow. Terminating the flow, by unmounting player on any given platform, will not execute `onEnd` expressions, as it would not have reached an `END` state. + 1. For an `onEnd` expression defined on an individual state, if a transition is halted (by validation or otherwise), the `onEnd` expressions for that state won't be executed. + 1. Player navigation is a state machine, `onEnd` expressions defined for the entire flow will only execute when the state machine ends the flow, by reaching an `END` state. Terminating the flow, by unmounting player on any given platform, will not execute flow defined `onEnd` expressions, as it would not have reached an `END` state. ## Examples From 482d2b01a97802b740a1061911e6a367a3649714 Mon Sep 17 00:00:00 2001 From: Harris Borawski Date: Tue, 19 Mar 2024 11:32:07 -0700 Subject: [PATCH 3/3] grammar update Co-authored-by: Ketan Reddy --- docs/site/pages/content/navigation.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/site/pages/content/navigation.mdx b/docs/site/pages/content/navigation.mdx index 25ec44a92..5e0ffd18b 100644 --- a/docs/site/pages/content/navigation.mdx +++ b/docs/site/pages/content/navigation.mdx @@ -102,7 +102,7 @@ State types can also contain `onStart` and `onEnd` properties for evaluating exp 2. `exp` 3. `onEnd` - Evaluated last, right before transition. 1. If a transition is halted (by validation or otherwise), the expression won't be executed. - 1. Player navigation is a state machine, `onEnd` expressions will only execute when the state machine ends the flow. Terminating the flow, by unmounting player on any given platform, will not execute `onEnd` expressions, as it would not have reached an `END` state. + 2. As Player's navigation is a state machine, `onEnd` expressions will only execute when the state machine ends the flow. Terminating the flow by unmounting Player (on any given platform) will not execute `onEnd` expressions as it would not have reached an `END` state. ## Examples