Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/long-teeth-worry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"bits-ui": patch
---

fix(FloatingContent): watch deps
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,14 @@ export class FloatingContentState {
});

watch(
() => this.contentRef.current,
(contentNode) => {
if (!contentNode || !this.opts.enabled.current) return;
[() => this.contentRef.current, () => this.opts.enabled.current],
([contentNode, enabled]) => {
if (!contentNode || !enabled) return;
const win = getWindow(contentNode);
const rafId = win.requestAnimationFrame(() => {
// avoid applying stale values when refs change quickly
if (this.contentRef.current !== contentNode || !this.opts.enabled.current) return;
if (this.contentRef.current !== contentNode || !this.opts.enabled.current)
return;
const zIndex = win.getComputedStyle(contentNode).zIndex;
if (zIndex !== this.contentZIndex) {
this.contentZIndex = zIndex;
Expand Down