I've tried a few things but it doesn't seem like the element is inserted to the DOM at the point where the ref is called, which does make a bit of sense, but I just can't find a proper escape hatch for this.
Tried:
- Using
setTimeout(..., 0)before setting - Checking if
document.contains(...)before setting - Using a hacky Mutation observer, not sure if I did my best on this one but doesn't seem optimal
For background, my use case is wit using https://github.com/lxsmnsyc/solid-floating-ui/tree/main (from @regal stream). The issue seems to happen when floating-ui itself tries to resolve the parent nodes for the floating element which do not exist at the point where the element hasn't yet been inserted in the DOM.