Skip to content

Commit c97d570

Browse files
committed
Added some clarifications to hook priorities
1 parent 4ccd540 commit c97d570

File tree

1 file changed

+37
-7
lines changed

1 file changed

+37
-7
lines changed

docs/concepts/stack/stack-settings.md

+37-7
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,47 @@ Environment variables are preserved from one phase to the next.
8080

8181
#### Note on hook ordering
8282

83-
Hooks added to stacks and contexts attached to them follow distinct ordering principles. Stack hooks are organized through a drag-and-drop mechanism, while context hooks adhere to prioritization based on context priority. Additionally, auto-attached contexts are arranged alphabetically.
83+
Hooks added to stacks and contexts attached to them follow distinct ordering principles. Stack hooks are organized through a drag-and-drop mechanism, while context hooks adhere to prioritization based on context priority. Additionally, auto-attached contexts are arranged alphabetically or reversed alphabetically depending on the operation type (before/after).
8484

85-
In the before phase, the priority of stack hooks is secondary to that of context hooks. Conversely, in the after phase, this priority order is reversed.
85+
Hooks from manually and auto-attached contexts can only be edited from their respective views.
8686

87-
Hooks from both manually and auto-attached contexts can only be edited from their respective views. Specifically, in the before phase:
87+
In the before phase, hook priorities work as follows:
8888

89-
- Hooks from manually attached contexts take precedence and are arranged according to context attachment priority.
90-
- Subsequently, hooks from auto-attached contexts, ordered alphabetically.
91-
- Stack hooks occupy the final position in the sequence.
89+
- context hooks (based on set priorities)
90+
- context auto-attached hooks (reversed alphabetically)
91+
- stack hooks
92+
93+
In the after phase, hook priorities work as follows:
94+
95+
- stack hooks
96+
- context auto-attached hooks (alphabetically)
97+
- context hooks (reversed priorities)
98+
99+
Let's suppose you have 4 contexts attached to a stack:
100+
101+
- context_a (auto-attached)
102+
- context_b (auto-attached)
103+
- context_c (priority 0)
104+
- context_d (priority 5)
105+
106+
In all of these contexts, we have added hooks that echo the context name before and after phases. To add to this, we will also add two static hooks on the stack level that will do a simple "echo stack".
107+
108+
Before phase order:
109+
110+
- context_c
111+
- context_d
112+
- context_b
113+
- context_a
114+
- stack
115+
116+
After phase order:
117+
118+
- stack
119+
- context_a
120+
- context_b
121+
- context_d
122+
- context_c
92123

93-
For the after phase, the ordering is reversed.
94124
{% endif %}
95125

96126
### Runtime commands

0 commit comments

Comments
 (0)