@tanstack/react-query-devtools 4.14.6 → 4.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -682,25 +682,38 @@ function ReactQueryDevtools$1({
682
682
  }
683
683
  }, [isResolvedOpen]);
684
684
  React.useEffect(() => {
685
- if (isResolvedOpen) {
686
- var _root$parentElement;
685
+ var _rootRef$current;
687
686
 
688
- const root = rootRef.current;
687
+ if (isResolvedOpen && (_rootRef$current = rootRef.current) != null && _rootRef$current.parentElement) {
688
+ const {
689
+ parentElement
690
+ } = rootRef.current;
689
691
  const styleProp = getSidedProp('padding', panelPosition);
690
692
  const isVertical = isVerticalSide(panelPosition);
691
- const previousValue = root == null ? void 0 : (_root$parentElement = root.parentElement) == null ? void 0 : _root$parentElement.style[styleProp];
693
+
694
+ const previousPaddings = (({
695
+ padding,
696
+ paddingTop,
697
+ paddingBottom,
698
+ paddingLeft,
699
+ paddingRight
700
+ }) => ({
701
+ padding,
702
+ paddingTop,
703
+ paddingBottom,
704
+ paddingLeft,
705
+ paddingRight
706
+ }))(parentElement.style);
692
707
 
693
708
  const run = () => {
694
- if (root != null && root.parentElement) {
695
- // reset the padding
696
- root.parentElement.style.padding = '0px';
697
- root.parentElement.style.paddingTop = '0px';
698
- root.parentElement.style.paddingBottom = '0px';
699
- root.parentElement.style.paddingLeft = '0px';
700
- root.parentElement.style.paddingRight = '0px'; // set the new padding based on the new panel position
701
-
702
- root.parentElement.style[styleProp] = (isVertical ? devtoolsWidth : devtoolsHeight) + "px";
703
- }
709
+ // reset the padding
710
+ parentElement.style.padding = '0px';
711
+ parentElement.style.paddingTop = '0px';
712
+ parentElement.style.paddingBottom = '0px';
713
+ parentElement.style.paddingLeft = '0px';
714
+ parentElement.style.paddingRight = '0px'; // set the new padding based on the new panel position
715
+
716
+ parentElement.style[styleProp] = (isVertical ? devtoolsWidth : devtoolsHeight) + "px";
704
717
  };
705
718
 
706
719
  run();
@@ -709,10 +722,9 @@ function ReactQueryDevtools$1({
709
722
  window.addEventListener('resize', run);
710
723
  return () => {
711
724
  window.removeEventListener('resize', run);
712
-
713
- if (root != null && root.parentElement && typeof previousValue === 'string') {
714
- root.parentElement.style[styleProp] = previousValue;
715
- }
725
+ Object.entries(previousPaddings).forEach(([property, previousValue]) => {
726
+ parentElement.style[property] = previousValue;
727
+ });
716
728
  };
717
729
  }
718
730
  }