Skip to content
Merged
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
8 changes: 6 additions & 2 deletions src/internal/container-queries/use-resize-observer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

// This effect provides a synchronous update required to prevent flakiness when initial state and first observed state are different.
// Can potentially conflict with React concurrent mode: https://17.reactjs.org/docs/concurrent-mode-intro.html.
// TODO: A possible solution would be to make consumers not render any content until the first (asynchronous) observation is available.

Check warning on line 39 in src/internal/container-queries/use-resize-observer.ts

View workflow job for this annotation

GitHub Actions / build / build

Unexpected 'todo' comment: 'TODO: A possible solution would be to...'
useLayoutEffect(
() => {
const element = typeof elementRef === 'function' ? elementRef() : elementRef?.current;
Expand Down Expand Up @@ -87,11 +87,15 @@
const paddingRight = parseFloat(computedStyle.paddingRight) || 0;
const paddingTop = parseFloat(computedStyle.paddingTop) || 0;
const paddingBottom = parseFloat(computedStyle.paddingBottom) || 0;
const borderLeft = parseFloat(computedStyle.borderLeftWidth) || 0;
const borderRight = parseFloat(computedStyle.borderRightWidth) || 0;
const borderTop = parseFloat(computedStyle.borderTopWidth) || 0;
const borderBottom = parseFloat(computedStyle.borderBottomWidth) || 0;

return {
target: element,
contentBoxWidth: rect.width - paddingLeft - paddingRight,
contentBoxHeight: rect.height - paddingTop - paddingBottom,
contentBoxWidth: rect.width - paddingLeft - paddingRight - borderLeft - borderRight,
contentBoxHeight: rect.height - paddingTop - paddingBottom - borderTop - borderBottom,
borderBoxWidth: rect.width,
borderBoxHeight: rect.height,
};
Expand Down
Loading