@localstack/appinspector-ui 1.0.106 → 1.0.107

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.cjs CHANGED
@@ -14871,6 +14871,7 @@ var LABEL_END_OF_STREAM = "This is the end of the stream";
14871
14871
  var LABEL_NO_SPANS = "There are no operations";
14872
14872
  var LABEL_LOAD_OLDER = "Load older operations";
14873
14873
  var LABEL_LOAD_NEWER = "Load newer operations";
14874
+ var STICK_TO_EDGE_THRESHOLD_PX = 4;
14874
14875
  var StreamBoundaryRow = ({ colSpan, label }) => /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(import_material6.TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(import_material6.TableCell, { colSpan, sx: { fontStyle: "italic", textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("span", { children: label }) }) });
14875
14876
  var LoadSpansRow = ({ colSpan, fetching, label, onFetch }) => /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(import_material6.TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(import_material6.TableCell, { colSpan, sx: { textAlign: "center" }, children: [
14876
14877
  !fetching && /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(import_material6.Button, { onClick: onFetch, sx: { my: 1 }, children: label }),
@@ -15029,6 +15030,28 @@ var SpansDataGrid = ({
15029
15030
  const columnCount = table.getAllColumns().length;
15030
15031
  const rows = table.getRowModel().rows;
15031
15032
  const hasRows = rows.length > 0;
15033
+ const containerRef = (0, import_react42.useRef)(null);
15034
+ const isAtLiveEdgeRef = (0, import_react42.useRef)(true);
15035
+ const handleScroll = (0, import_react42.useCallback)(() => {
15036
+ const element = containerRef.current;
15037
+ if (!element) return;
15038
+ if (order2 === "oldest_first") {
15039
+ const distanceFromBottom = element.scrollHeight - element.scrollTop - element.clientHeight;
15040
+ isAtLiveEdgeRef.current = distanceFromBottom <= STICK_TO_EDGE_THRESHOLD_PX;
15041
+ return;
15042
+ }
15043
+ isAtLiveEdgeRef.current = element.scrollTop <= STICK_TO_EDGE_THRESHOLD_PX;
15044
+ }, [order2]);
15045
+ const lastSpanId = spans?.at(-1)?.span_id;
15046
+ (0, import_react42.useLayoutEffect)(() => {
15047
+ handleScroll();
15048
+ }, [handleScroll]);
15049
+ (0, import_react42.useLayoutEffect)(() => {
15050
+ if (order2 !== "oldest_first") return;
15051
+ const element = containerRef.current;
15052
+ if (!element || !isAtLiveEdgeRef.current) return;
15053
+ element.scrollTop = element.scrollHeight;
15054
+ }, [order2, spans?.length, lastSpanId]);
15032
15055
  return /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(import_jsx_runtime127.Fragment, { children: [
15033
15056
  /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(import_material6.Grid, { item: true, xs: 12, children: /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(import_material6.Box, { sx: { alignItems: "center", display: "flex", gap: "0.5rem" }, children: [
15034
15057
  /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(SpanCountBadge, { licenseLimit, systemLimit, totalCount, visibleCount: spans?.length }),
@@ -15086,6 +15109,8 @@ var SpansDataGrid = ({
15086
15109
  /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(import_material6.Paper, { sx: { flexGrow: 1, overflow: "hidden", position: "relative", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
15087
15110
  import_material6.TableContainer,
15088
15111
  {
15112
+ onScroll: handleScroll,
15113
+ ref: containerRef,
15089
15114
  sx: {
15090
15115
  bottom: 0,
15091
15116
  flexGrow: 1,