@@ -122,12 +122,12 @@ class FloatingOptions<RT extends ReferenceType = ReferenceType> {
122
122
reason ?: OpenChangeReason ,
123
123
) => void ;
124
124
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 ) ;
129
125
floatingProp = $derived . by ( ( ) => extract ( this . options . floating , null ) ) ;
130
126
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 > ;
131
131
constructor ( private readonly options : UseFloatingOptions < RT > ) {
132
132
this . open = box . with ( ( ) => extract ( options . open , true ) ) ;
133
133
this . placement = box . with ( ( ) => extract ( options . placement , "bottom" ) ) ;
@@ -156,8 +156,8 @@ class FloatingOptions<RT extends ReferenceType = ReferenceType> {
156
156
this . onFloatingChange ( node ) ;
157
157
} ,
158
158
) ;
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 ) ;
161
161
162
162
$effect . pre ( ( ) => {
163
163
if ( this . floatingProp ) {
@@ -296,6 +296,8 @@ class FloatingState<RT extends ReferenceType = ReferenceType> {
296
296
context : FloatingContext < RT > ;
297
297
298
298
constructor ( private readonly options : FloatingOptions < RT > ) {
299
+ console . log ( options . reference . current ) ;
300
+
299
301
const internalRootContext = useFloatingRootContext ( {
300
302
open : ( ) => options . open . current ?? true ,
301
303
reference : ( ) => options . reference . current ,
@@ -337,7 +339,7 @@ class FloatingState<RT extends ReferenceType = ReferenceType> {
337
339
}
338
340
339
341
get reference ( ) {
340
- return this . #positionReference as RT | null ;
342
+ return this . options . reference . current as RT | null ;
341
343
}
342
344
343
345
set reference ( node : RT | null ) {
0 commit comments