Skip to content

Conversation

@mscolnick
Copy link
Contributor

@mscolnick mscolnick commented Jan 28, 2026

Closes #8029

When a table has more columns than max_columns (default 50), column
clamping would exclude the _marimo_row_id column from the data sent
to the frontend. Without this column, the frontend falls back to
positional indices for row identification, which breaks selection after
filtering — selecting a row returns data from the wrong row.

Fix

Always include _marimo_row_id in the selected columns when clamping,
so the frontend can use stable row IDs for correct selection regardless
of column count.

## Summary

When a table has more columns than `max_columns` (default 50), column
clamping would exclude the `_marimo_row_id` column from the data sent
to the frontend. Without this column, the frontend falls back to
positional indices for row identification, which breaks selection after
filtering — selecting a row returns data from the wrong row.

## Fix

Always include `_marimo_row_id` in the selected columns when clamping,
so the frontend can use stable row IDs for correct selection regardless
of column count.
@vercel
Copy link

vercel bot commented Jan 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
marimo-docs Ready Ready Preview, Comment Jan 28, 2026 6:37pm

Request Review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a critical bug where selecting rows in a filtered table with more than 50 columns would return data from the wrong rows. The root cause was that column clamping excluded the _marimo_row_id column, forcing the frontend to fall back to positional indices which broke after filtering.

Changes:

  • Always include _marimo_row_id in clamped column selection when the table has stable row IDs
  • Update existing tests to expect max_columns + 1 columns (accounting for _marimo_row_id)
  • Add comprehensive regression test that verifies selection works correctly with clamped columns and filtering

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
marimo/_plugins/ui/_impl/table.py Modified column clamping logic to always include _marimo_row_id when present, ensuring frontend can use stable row IDs for selection
tests/_plugins/ui/_impl/test_table.py Updated existing column clamping tests to account for _marimo_row_id column and added regression test verifying selection works correctly with clamped columns and filtering

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mo.ui.table: Selection (table.value) is wrong if table has more than 50 columns and table is filtered interactively

3 participants