@marimo-team/islands 0.22.1-dev41 → 0.22.1-dev42

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/main.js CHANGED
@@ -33827,7 +33827,11 @@ Database schema: ${c}`), (_a4 = r2.aiFix) == null ? void 0 : _a4.setAiCompletion
33827
33827
  className: cn("h-auto min-h-10 whitespace-pre align-top", c2),
33828
33828
  style: d,
33829
33829
  ref: (c3) => {
33830
- columnSizingHandler(c3, e, r4.column);
33830
+ columnSizingHandler({
33831
+ table: e,
33832
+ column: r4.column,
33833
+ thead: c3
33834
+ });
33831
33835
  },
33832
33836
  children: r4.isPlaceholder ? null : flexRender(r4.column.columnDef.header, r4.getContext())
33833
33837
  }, r4.id);
@@ -33982,10 +33986,12 @@ Database schema: ${c}`), (_a4 = r2.aiFix) == null ? void 0 : _a4.setAiCompletion
33982
33986
  }
33983
33987
  };
33984
33988
  }
33985
- function columnSizingHandler(e, r, c) {
33986
- e && r.getState().columnSizing[c.id] !== e.getBoundingClientRect().width && r.setColumnSizing((r2) => ({
33987
- ...r2,
33988
- [c.id]: e.getBoundingClientRect().width
33989
+ function columnSizingHandler({ table: e, column: r, thead: c }) {
33990
+ if (!c) return;
33991
+ let d = Math.round(c.getBoundingClientRect().width);
33992
+ e.getState().columnSizing[r.id] !== d && e.setColumnSizing((e2) => ({
33993
+ ...e2,
33994
+ [r.id]: d
33989
33995
  }));
33990
33996
  }
33991
33997
  var MAX_PAGES_BEFORE_CLAMPING = 100;
@@ -65513,7 +65519,7 @@ ${c}
65513
65519
  return Logger.warn("Failed to get version from mount config"), null;
65514
65520
  }
65515
65521
  }
65516
- const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.22.1-dev41"), showCodeInRunModeAtom = atom(true);
65522
+ const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.22.1-dev42"), showCodeInRunModeAtom = atom(true);
65517
65523
  atom(null);
65518
65524
  var VIRTUAL_FILE_REGEX = /\/@file\/([^\s"&'/]+)\.([\dA-Za-z]+)/g, VirtualFileTracker = class e {
65519
65525
  constructor() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.22.1-dev41",
3
+ "version": "0.22.1-dev42",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -9,7 +9,6 @@ import {
9
9
  type HeaderGroup,
10
10
  type Row,
11
11
  type Table,
12
- type Table as TanStackTable,
13
12
  } from "@tanstack/react-table";
14
13
  import { useVirtualizer } from "@tanstack/react-virtual";
15
14
  import { type JSX, useLayoutEffect, useRef, useState } from "react";
@@ -52,7 +51,7 @@ export function renderTableHeader<TData>(
52
51
  )}
53
52
  style={style}
54
53
  ref={(thead) => {
55
- columnSizingHandler(thead, table, header.column);
54
+ columnSizingHandler({ table, column: header.column, thead });
56
55
  }}
57
56
  >
58
57
  {header.isPlaceholder
@@ -323,23 +322,30 @@ function getPinningStyles<TData>(
323
322
 
324
323
  // Update column sizes in table state for column pinning offsets
325
324
  // https://github.com/TanStack/table/discussions/3947#discussioncomment-9564867
326
- function columnSizingHandler<TData>(
327
- thead: HTMLTableCellElement | null,
328
- table: TanStackTable<TData>,
329
- column: Column<TData>,
330
- ) {
325
+ function columnSizingHandler<TData>({
326
+ table,
327
+ column,
328
+ thead,
329
+ }: {
330
+ table: Table<TData>;
331
+ column: Column<TData>;
332
+ thead: HTMLTableCellElement | null;
333
+ }): void {
331
334
  if (!thead) {
332
335
  return;
333
336
  }
334
- if (
335
- table.getState().columnSizing[column.id] ===
336
- thead.getBoundingClientRect().width
337
- ) {
337
+ // Round to avoid infinite re-render loops: the browser's table layout
338
+ // algorithm may render a <th> at a slightly different width than the
339
+ // CSS `width` we set via column.getSize(), so a strict float === float
340
+ // comparison never stabilizes. Rounding to integers ensures convergence
341
+ // after at most one cycle.
342
+ const measuredWidth = Math.round(thead.getBoundingClientRect().width);
343
+ if (table.getState().columnSizing[column.id] === measuredWidth) {
338
344
  return;
339
345
  }
340
346
 
341
347
  table.setColumnSizing((prevSizes) => ({
342
348
  ...prevSizes,
343
- [column.id]: thead.getBoundingClientRect().width,
349
+ [column.id]: measuredWidth,
344
350
  }));
345
351
  }