Skip to content

Commit dd200af

Browse files
nickschotzacharygolba
authored andcommitted
docs: clarify after action behavior (#690)
1 parent b636bf5 commit dd200af

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/packages/controller/index.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -405,14 +405,15 @@ class Controller {
405405
*
406406
* Functions called from the `afterAction` hook will have `request` and
407407
* `response` objects passed as arguments as well as a third `payload`
408-
* arguments that is a reference to resolved data of the Controller action
409-
* that was called within the current `request` / `response` cycle. If you
410-
* return a value from a function added to the `afterAction` hook, that value
411-
* will be used instead of the resolved data from the preceding Conroller
412-
* action. Subsequent hooks called from an `afterAction` hook will will use
413-
* the value returned or resolved from preceding hook. This makes
414-
* `afterAction` a great place to modify the data you are sending back to the
415-
* client.
408+
* argument. The `payload` argument is a reference to the resolved data of
409+
* the Controller action that was called within the current `request` /
410+
* `response` cycle. You need to explicitly return this `payload` in order for
411+
* the afterAction to resolve with it's data. If you return a modified value
412+
* from a function added to the `afterAction` hook, that value will be used
413+
* instead of the resolved data from the preceding Controller action.
414+
* Subsequent hooks called from an `afterAction` hook will will use the value
415+
* returned or resolved from the preceding hook. This makes `afterAction` a
416+
* great place to modify the data you are sending back to the client.
416417
*
417418
* **Example:**
418419
*

0 commit comments

Comments
 (0)