@wise/dynamic-flow-client-internal 5.26.0 → 5.27.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.
package/build/main.js CHANGED
@@ -146,7 +146,7 @@ var import_dynamic_flow_client4 = require("@wise/dynamic-flow-client");
146
146
  // src/dynamicFlow/telemetry/app-version.ts
147
147
  var appVersion = (
148
148
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
149
- typeof process !== "undefined" ? "5.26.0" : "0.0.0"
149
+ typeof process !== "undefined" ? "5.27.0" : "0.0.0"
150
150
  );
151
151
 
152
152
  // src/dynamicFlow/context-menu/useContextMenu.tsx
@@ -2482,9 +2482,12 @@ var useIsElementVisible = (elementRef) => {
2482
2482
  (0, import_react8.useEffect)(() => {
2483
2483
  const element = elementRef.current;
2484
2484
  if (!element) return;
2485
- const observer = new IntersectionObserver(([entry]) => {
2486
- setIsVisible(entry.isIntersecting);
2487
- });
2485
+ const observer = new IntersectionObserver(
2486
+ ([entry]) => {
2487
+ setIsVisible(entry.isIntersecting);
2488
+ },
2489
+ { rootMargin: "1px" }
2490
+ );
2488
2491
  observer.observe(element);
2489
2492
  return () => observer.disconnect();
2490
2493
  }, [elementRef]);
@@ -2511,11 +2514,11 @@ var ContentComponent = (props) => {
2511
2514
  const endOfContentRef = (0, import_react9.useRef)(null);
2512
2515
  const isBottomVisible = useIsElementVisible(endOfContentRef);
2513
2516
  (0, import_react9.useEffect)(() => {
2514
- const shouldAutoLoad = isBottomVisible && status.type === "idle" && !state.afterSections;
2517
+ const shouldAutoLoad = isBottomVisible && status.type === "idle" && state.afterSectionsProps.length === 0;
2515
2518
  if (shouldAutoLoad && status.loadMore) {
2516
2519
  status.loadMore();
2517
2520
  }
2518
- }, [isBottomVisible, state.afterSections, status]);
2521
+ }, [isBottomVisible, state.afterSectionsProps.length, status]);
2519
2522
  const stateCount = state.sections.reduce(
2520
2523
  (total, section) => section.items.length + total + (section.title ? 1 : 0),
2521
2524
  0
@@ -2599,7 +2602,7 @@ var PaginationComponent = ({
2599
2602
  if (isPaginationError) {
2600
2603
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(LoadMoreButton, { onClick: status.retry });
2601
2604
  }
2602
- if (state.afterSections && loadMore) {
2605
+ if (state.afterSectionsProps.length > 0 && loadMore) {
2603
2606
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(LoadMoreButton, { onClick: loadMore });
2604
2607
  }
2605
2608
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_components15.ProcessIndicator, { size: "xs", "data-testid": "collection-pagination-loader" });
package/build/main.mjs CHANGED
@@ -127,7 +127,7 @@ import { useDynamicFlow } from "@wise/dynamic-flow-client";
127
127
  // src/dynamicFlow/telemetry/app-version.ts
128
128
  var appVersion = (
129
129
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
130
- typeof process !== "undefined" ? "5.26.0" : "0.0.0"
130
+ typeof process !== "undefined" ? "5.27.0" : "0.0.0"
131
131
  );
132
132
 
133
133
  // src/dynamicFlow/context-menu/useContextMenu.tsx
@@ -2469,9 +2469,12 @@ var useIsElementVisible = (elementRef) => {
2469
2469
  useEffect6(() => {
2470
2470
  const element = elementRef.current;
2471
2471
  if (!element) return;
2472
- const observer = new IntersectionObserver(([entry]) => {
2473
- setIsVisible(entry.isIntersecting);
2474
- });
2472
+ const observer = new IntersectionObserver(
2473
+ ([entry]) => {
2474
+ setIsVisible(entry.isIntersecting);
2475
+ },
2476
+ { rootMargin: "1px" }
2477
+ );
2475
2478
  observer.observe(element);
2476
2479
  return () => observer.disconnect();
2477
2480
  }, [elementRef]);
@@ -2498,11 +2501,11 @@ var ContentComponent = (props) => {
2498
2501
  const endOfContentRef = useRef3(null);
2499
2502
  const isBottomVisible = useIsElementVisible(endOfContentRef);
2500
2503
  useEffect7(() => {
2501
- const shouldAutoLoad = isBottomVisible && status.type === "idle" && !state.afterSections;
2504
+ const shouldAutoLoad = isBottomVisible && status.type === "idle" && state.afterSectionsProps.length === 0;
2502
2505
  if (shouldAutoLoad && status.loadMore) {
2503
2506
  status.loadMore();
2504
2507
  }
2505
- }, [isBottomVisible, state.afterSections, status]);
2508
+ }, [isBottomVisible, state.afterSectionsProps.length, status]);
2506
2509
  const stateCount = state.sections.reduce(
2507
2510
  (total, section) => section.items.length + total + (section.title ? 1 : 0),
2508
2511
  0
@@ -2586,7 +2589,7 @@ var PaginationComponent = ({
2586
2589
  if (isPaginationError) {
2587
2590
  return /* @__PURE__ */ jsx33(LoadMoreButton, { onClick: status.retry });
2588
2591
  }
2589
- if (state.afterSections && loadMore) {
2592
+ if (state.afterSectionsProps.length > 0 && loadMore) {
2590
2593
  return /* @__PURE__ */ jsx33(LoadMoreButton, { onClick: loadMore });
2591
2594
  }
2592
2595
  return /* @__PURE__ */ jsx33(ProcessIndicator, { size: "xs", "data-testid": "collection-pagination-loader" });