@bpmn-io/properties-panel 1.8.0 → 1.8.1

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.
package/dist/index.esm.js CHANGED
@@ -394,6 +394,10 @@ function useStickyIntersectionObserver(ref, scrollContainerSelector, setSticky)
394
394
  if (ref.current) {
395
395
  const scrollContainer = query(scrollContainerSelector);
396
396
  observer = new Observer(entries => {
397
+ // The ScrollContainer is unmounted, do not update sticky state
398
+ if (scrollContainer.scrollHeight === 0) {
399
+ return;
400
+ }
397
401
  entries.forEach(entry => {
398
402
  if (entry.intersectionRatio < 1) {
399
403
  setSticky(true);
@@ -640,7 +644,7 @@ function PropertiesPanel(props) {
640
644
  const [layout, setLayout] = useState(createLayout(layoutConfig));
641
645
 
642
646
  // react to external changes in the layout config
643
- useUpdateEffect(() => {
647
+ useUpdateLayoutEffect(() => {
644
648
  const newLayout = createLayout(layoutConfig);
645
649
  setLayout(newLayout);
646
650
  }, [layoutConfig]);
@@ -761,14 +765,14 @@ function createDescriptionContext(overrides = {}) {
761
765
  // hooks //////////////////
762
766
 
763
767
  /**
764
- * This hook behaves like useEffect, but does not trigger on the first render.
768
+ * This hook behaves like useLayoutEffect, but does not trigger on the first render.
765
769
  *
766
770
  * @param {Function} effect
767
771
  * @param {Array} deps
768
772
  */
769
- function useUpdateEffect(effect, deps) {
773
+ function useUpdateLayoutEffect(effect, deps) {
770
774
  const isMounted = useRef(false);
771
- useEffect(() => {
775
+ useLayoutEffect(() => {
772
776
  if (isMounted.current) {
773
777
  return effect();
774
778
  } else {