@@ -16,7 +16,10 @@ declare let acquireVsCodeApi: any
1616const editor = acquireVsCodeApi ( )
1717const editorSend = ( action :T . Action ) => {
1818logger ( `TO EXT: "${ action . type } "` )
19- return editor . postMessage ( action )
19+ return editor . postMessage ( {
20+ ...action ,
21+ source :'coderoad' , // filter events by source on editor side
22+ } )
2023}
2124
2225// router finds first state match of <Route path='' />
@@ -31,14 +34,15 @@ const useStateMachine = (): Output => {
3134// event bus listener
3235React . useEffect ( ( ) => {
3336const listener = 'message'
34- //propograte channel event to state machine
37+ //propagate channel event to state machine
3538const handler = ( event :any ) => {
36- // ensure events are coming from coderoad webview
37- if ( ! event . origin . match ( / ^ v s c o d e - w e b v i e w / ) ) {
38- return
39- }
4039// NOTE: must call event.data, cannot destructure. VSCode acts odd
4140const action = event . data
41+
42+ if ( action . source !== 'coderoad' ) {
43+ // filter out events from other extensions
44+ return
45+ }
4246sendWithLog ( action )
4347}
4448window . addEventListener ( listener , handler )