@@ -5,18 +5,7 @@ import { WidgetInput, WidgetTypeId } from '@/providers/widgetRegistry'
5
5
import { injectWidgetTree , type CurrentEdit } from '@/providers/widgetTree'
6
6
import type { Ast } from '@/util/ast'
7
7
import { ArgumentInfoKey } from '@/util/callTree'
8
- import { ToValue } from '@/util/reactivity'
9
- import {
10
- computed ,
11
- markRaw ,
12
- shallowRef ,
13
- toValue ,
14
- useId ,
15
- watch ,
16
- watchEffect ,
17
- WatchSource ,
18
- type ShallowRef ,
19
- } from 'vue'
8
+ import { computed , markRaw , shallowRef , useId , watch , WatchSource , type ShallowRef } from 'vue'
20
9
import { assertDefined } from 'ydoc-shared/util/assert'
21
10
22
11
declare const widgetInstanceIdBrand : unique symbol
@@ -271,7 +260,7 @@ export class WidgetEditHandler extends WidgetEditHandlerParent {
271
260
272
261
/** Create {@link WidgetEditHandler} by manually providing all needed inputs. Useful for testing. */
273
262
static NewRaw (
274
- widgetInstanceId : ToValue < WidgetInstanceId > ,
263
+ widgetInstanceId : WatchSource < WidgetInstanceId > ,
275
264
portId : WatchSource < PortId > ,
276
265
parent : WatchSource < WidgetEditHandlerParent | undefined > ,
277
266
myInteraction : WidgetEditHooks ,
@@ -294,13 +283,14 @@ export class WidgetEditHandler extends WidgetEditHandlerParent {
294
283
{ immediate : true } ,
295
284
)
296
285
assertDefined ( currentHandler . value )
297
- watchEffect ( ( onCleanup ) => {
298
- const handler = currentHandler . value
299
- const id = toValue ( widgetInstanceId )
300
- handler . tryResume ( id , handler . portId )
301
- onCleanup ( ( ) => handler . suspend ( id ) )
302
- } )
303
-
286
+ watch (
287
+ [ currentHandler , widgetInstanceId ] ,
288
+ ( [ handler , id ] , _ , onCleanup ) => {
289
+ handler . tryResume ( id , handler . portId )
290
+ onCleanup ( ( ) => handler . suspend ( id ) )
291
+ } ,
292
+ { immediate : true } ,
293
+ )
304
294
return currentHandler
305
295
}
306
296
0 commit comments