Commit b167c84
Resurrect
* fix(compiler): Wait for charm initialization before navigating
The issue was that navigateTo was being called immediately with the result
from compileAndRun, but the result Cell is initially undefined and only gets
populated asynchronously after compilation completes.
Solution follows the same pattern used in chatbot-list-view.tsx:
- Use a lift to monitor the result Cell reactively
- Only navigate once the result is populated (not undefined)
- Use an isNavigated flag to ensure navigation only happens once
Changes:
- Add navigateWhenReady lift that waits for result to be ready
- Update visit handler to use the lift instead of calling navigateTo directly
- Show actual error messages in the UI instead of generic "fix the errors"
This fixes the "blackhole" issue where navigateTo appeared to do nothing.
* fix(compiler): Reuse compileAndRun result instead of creating new action
The previous approach called compileAndRun inside the handler, which:
- Created a NEW compileAndRun action on every handler invocation
- Caused double invocation due to re-renders from pending state changes
- Hit the run index check at compile-and-run.ts:191 and bailed early
Solution:
- Call compileAndRun once in the recipe body (already done for error display)
- Reuse the stable result cell from that single compileAndRun call
- Handler just calls navigateTo(result) on the existing cell
- navigateTo is an Action, so it re-runs when result populates
This is much simpler and avoids the double invocation issue entirely.
No need for the navigateWhenReady lift workaround!
* Copy across cancellation pattern from `llm.ts`
* Move `compiler.tsx` to patterns package
* fix(compiler): Clear pending state after cancellation
Remove abort signal check from finally block to ensure pending state is always reset to false when compilation completes, whether successfully, with error, or cancelled. This prevents the compile action from getting stuck in pending=true state after cancellation.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
---------
Co-authored-by: Claude <[email protected]>compileAndRun example and integrate omnibot (commontoolsinc#2025)1 parent 7696b91 commit b167c84
File tree
2 files changed
+46
-19
lines changed- packages
- patterns
- runner/src/builtins
2 files changed
+46
-19
lines changedLines changed: 18 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
| 31 | + | |
| 32 | + | |
33 | 33 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 34 | + | |
| 35 | + | |
42 | 36 | | |
43 | 37 | | |
44 | 38 | | |
45 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
46 | 49 | | |
47 | 50 | | |
48 | 51 | | |
49 | | - | |
| 52 | + | |
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
| |||
63 | 66 | | |
64 | 67 | | |
65 | 68 | | |
66 | | - | |
| 69 | + | |
67 | 70 | | |
68 | | - | |
| 71 | + | |
69 | 72 | | |
70 | 73 | | |
71 | 74 | | |
72 | 75 | | |
73 | 76 | | |
74 | 77 | | |
75 | 78 | | |
| 79 | + | |
| 80 | + | |
76 | 81 | | |
77 | 82 | | |
78 | 83 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
55 | 62 | | |
56 | 63 | | |
57 | 64 | | |
| |||
97 | 104 | | |
98 | 105 | | |
99 | 106 | | |
100 | | - | |
| 107 | + | |
101 | 108 | | |
102 | 109 | | |
103 | 110 | | |
| |||
135 | 142 | | |
136 | 143 | | |
137 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
138 | 150 | | |
139 | 151 | | |
140 | 152 | | |
| |||
156 | 168 | | |
157 | 169 | | |
158 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
159 | 174 | | |
160 | 175 | | |
161 | 176 | | |
162 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
163 | 180 | | |
164 | 181 | | |
165 | 182 | | |
| |||
180 | 197 | | |
181 | 198 | | |
182 | 199 | | |
183 | | - | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
184 | 203 | | |
185 | 204 | | |
186 | 205 | | |
187 | 206 | | |
188 | 207 | | |
189 | 208 | | |
190 | 209 | | |
191 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
192 | 214 | | |
193 | 215 | | |
194 | 216 | | |
| |||
0 commit comments