# Ray - The post-routing hook is up as three tsci... Channel: #contributor Source: https://discord.com/channels/1233487248129921135/1560307870036135997 Started: 2026-10-15T15:06:26.240000+00:00 Last activity: 2026-10-15T21:26:05.316000+00:00 ## Ray — 2026-10-15T15:06:25.335000+00:00 The post-routing hook is up as three tscircuit PRs. The core PR is a draft until the props PR is merged and released. [props#939](https://github.com/tscircuit/props/pull/939) adds the pcbPostRoutingHook prop to and subcircuit , with the typed context the hook receives. The PR body covers the details the props repo asks for (accepted inputs, defaults, migration). All 684 props tests pass and typecheck is clean. [core#4657](https://github.com/tscircuit/core/pull/4657) is the implementation. It needs the props change, so after props#939 is released I'll bump @tscircuit/props in core and mark it ready. [docs#947](https://github.com/tscircuit/docs/pull/947) adds an "Edit the PCB After Routing" page. Its example runs correctly against the core branch. [core#4629](https://github.com/tscircuit/core/issues/4629), the issue, now links all three. ## Seve — 2026-10-15T15:24:44.210000+00:00 RE: pcbPostRoutingHook- why not use an autoroutingphase? ## Seve — 2026-10-15T15:25:28.344000+00:00 you can set the phaseOrderIndex to order one or more phases ## Seve — 2026-10-15T15:25:55.037000+00:00 the problem with hooks is you can't "stack hooks" as easily, they are also more tightly TS-coupled ## Ray — 2026-10-15T15:31:17.302000+00:00 (claude response) I tried it. autoroutingphase + algorithmFn on core main can't cover this: - a phase only runs when it has connections, reroute+region/connection, or pcbTracePaths. A trailing "after everything" phase with just algorithmFn never gets called - with reroute+region it re-routes: it cuts traces at the region edge and hands the solver the pieces, with obstacles as abstract rects - the output is SimplifiedPcbTrace[] only. I returned a pcb_smtpad and it was silently dropped, so no test pads, silkscreen, keepouts or custom DRC errors - returning the existing traces wider left both copies on the board (0.15 and 0.5), so it can't edit the router's traces either The hook's job is editing circuit-json (insert/update/remove any pcb_* element) after routing and before pours/DRC. That's a different contract from "routing problem in, traces out". You're right about stacking though. Would you take it as an ordered element instead of a prop, e.g. , several allowed, run in order, each journaled/undone on reroute? Same shape as autoroutingphase. And by TS-coupled do you mean you'd want something serializable rather than a function? algorithmFn is a function too, so I want to make sure I get what you mean. ## Ray — 2026-10-15T16:09:53.926000+00:00 an even better solution that might also address your issues is to actually be able to write tsx that handles post routing hook. I'm dogfooding on my own contacts with ears design now. Attachment: image.png — https://community.tscircuit.com/media/1560323844185661530 ## Seve — 2026-10-15T16:12:24.760000+00:00 what is an ear in this case ## Seve — 2026-10-15T16:13:42.902000+00:00 it seems like if we adjust how reroute works it could work- reroute should be able to work without a bounded region ## Ray — 2026-10-15T16:18:37.771000+00:00 https://discord.com/channels/1233487248129921135/1415179482641469490/1560010488308433027 The ear is my use case and I’m trying to add support to tscircuit in a generic way so that I can do this in userland without hard coding it in tsci ## Seve — 2026-10-15T16:34:17.790000+00:00 ah ok yes- sorry, still catching up on threads ## Seve — 2026-10-15T16:34:46.654000+00:00 this is very interesting, it's kind of a footprint adjustment ## Ray — 2026-10-15T16:36:03.963000+00:00 a dynamic one, to stick the test point around the routed traces but before the copper pour ## Seve — 2026-10-15T16:36:22.163000+00:00 right that's a really good userland case ## Seve — 2026-10-15T16:37:33.920000+00:00 i think we may want to use real hooks ## Seve — 2026-10-15T16:38:48.884000+00:00 i.e. react hooks, that's how this would conventionally work in a react paradigm ## Seve — 2026-10-15T16:39:36.090000+00:00 basically if you want to adjust based on output and insert new elements, that's actually a pretty normal thing in react ## Seve — 2026-10-15T16:39:51.696000+00:00 we just don't support conventional hooks right now ## Seve — 2026-10-15T16:40:00.755000+00:00 but you could do a lot more if we did ## Seve — 2026-10-15T16:40:17.771000+00:00 i will iterate on some approaches today ## Ray — 2026-10-15T16:41:30.466000+00:00 I'm finishing my good PR update shortly to show the functionality I want and you can try other things for parity all you want 🙂 ## Ray — 2026-10-15T16:42:47.034000+00:00 my favorite tscircuit pastime: writing complex code that will never be merged upstream 😂 ## Ray — 2026-10-15T21:25:49.574000+00:00 I believe I am all done working on these PRs, ball is fully in your court. ## Seve — 2026-10-15T21:26:05.316000+00:00 yep working on it