File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { PluginContextProvider , type Plugin } from "@opencode-ai/plugin/tui"
22import {
33 batch ,
4+ createComponent ,
45 createContext ,
56 createEffect ,
67 createMemo ,
78 ErrorBoundary ,
89 For ,
10+ mergeProps ,
911 on ,
1012 onCleanup ,
1113 onMount ,
@@ -793,7 +795,7 @@ export function PluginRoute(props: { readonly fallback: (id: string, name: strin
793795 < Show keyed when = { current ( ) } >
794796 { ( item ) => (
795797 < PluginBoundary id = { item . id } where = "route" >
796- { item . render ? item . render ( { data : item . data } ) : props . fallback ( item . id , item . name ) }
798+ { item . render ? createComponent ( item . render , { data : item . data } ) : props . fallback ( item . id , item . name ) }
797799 </ PluginBoundary >
798800 ) }
799801 </ Show >
@@ -815,7 +817,14 @@ export function PluginSlot<Name extends SlotName>(props: {
815817 < For each = { renderers ( ) } >
816818 { ( item ) => (
817819 < PluginBoundary id = { item . id } where = { `slot ${ props . name } ` } >
818- { item . render ( props . input ) }
820+ {
821+ // Component semantics: the render body runs once and untracked, so
822+ // signals and intervals created inside are stable, while props stay
823+ // reactive through the merged getter. A bare item.render(props.input)
824+ // call would run inside the host's tracked scope and re-execute the
825+ // whole body (resetting plugin state) on every tracked read.
826+ createComponent ( item . render , mergeProps ( ( ) => props . input ) as SlotMap [ Name ] )
827+ }
819828 </ PluginBoundary >
820829 ) }
821830 </ For >
You can’t perform that action at this time.
0 commit comments