@@ -122,12 +122,12 @@ class FloatingOptions<RT extends ReferenceType = ReferenceType> {
122122 reason ?: OpenChangeReason ,
123123 ) => void ;
124124 nodeId : ReadableBox < string | undefined > ;
125- #stableReference = $state < Element | null > ( null ) ;
126- #stableFloating = $state < HTMLElement | null > ( null ) ;
127- reference : WritableBox < Element | null > = box ( null ) ;
128- floating : WritableBox < HTMLElement | null > = box ( null ) ;
129125 floatingProp = $derived . by ( ( ) => extract ( this . options . floating , null ) ) ;
130126 referenceProp = $derived . by ( ( ) => extract ( this . options . reference , null ) ) ;
127+ #stableReference = $state < Element | null > ( null ) ;
128+ #stableFloating = $state < HTMLElement | null > ( null ) ;
129+ reference : WritableBox < Element | null > ;
130+ floating : WritableBox < HTMLElement | null > ;
131131 constructor ( private readonly options : UseFloatingOptions < RT > ) {
132132 this . open = box . with ( ( ) => extract ( options . open , true ) ) ;
133133 this . placement = box . with ( ( ) => extract ( options . placement , "bottom" ) ) ;
@@ -156,8 +156,8 @@ class FloatingOptions<RT extends ReferenceType = ReferenceType> {
156156 this . onFloatingChange ( node ) ;
157157 } ,
158158 ) ;
159- this . reference . current = this . referenceProp ;
160- this . floating . current = this . floatingProp ;
159+ this . reference . current = extract ( this . options . reference , null ) ;
160+ this . floating . current = extract ( this . options . floating , null ) ;
161161
162162 $effect . pre ( ( ) => {
163163 if ( this . floatingProp ) {
@@ -296,6 +296,8 @@ class FloatingState<RT extends ReferenceType = ReferenceType> {
296296 context : FloatingContext < RT > ;
297297
298298 constructor ( private readonly options : FloatingOptions < RT > ) {
299+ console . log ( options . reference . current ) ;
300+
299301 const internalRootContext = useFloatingRootContext ( {
300302 open : ( ) => options . open . current ?? true ,
301303 reference : ( ) => options . reference . current ,
@@ -337,7 +339,7 @@ class FloatingState<RT extends ReferenceType = ReferenceType> {
337339 }
338340
339341 get reference ( ) {
340- return this . #positionReference as RT | null ;
342+ return this . options . reference . current as RT | null ;
341343 }
342344
343345 set reference ( node : RT | null ) {
0 commit comments