Data sources table search does not ignore surrounding whitespace
Describe the bug
The table search in the Data sources panel does not ignore surrounding whitespace, so a stray space hides tables:
- Searching
orderslists theorderstable. Typing one more space (orders), or pasting the name with a trailing space, empties the list. - A search that is only a space hides every table. The clear button does not appear, because it only shows when the trimmed search is non-empty, so the panel looks empty with no obvious way back.
The database tree already trims the search when deciding which schemas to expand (schemaSubtreeMatchesSearch in components/datasources/utils.ts), but TableList filters on the raw value. With a trailing space a SQL schema can therefore expand and show no tables.
Expected: surrounding whitespace is ignored, so orders matches like orders, and a whitespace-only search shows every table, like an empty search.
A fix with a regression test is ready.
Will you submit a PR?
- [x] Yes
Environment
{
"marimo": "0.25.2",
"editable": true,
"OS": "Darwin",
"OS Version": "27.0.0",
"Processor": "arm",
"Python Version": "3.12.13",
"Binaries": {
"Browser": "157.0.8103.52",
"Node": "v22.22.3"
}
}
Reproduced on main at 9bdfb76.
Code to reproduce
import marimo
app = marimo.App()
@app.cell
def _():
import polars as pl
return (pl,)
@app.cell
def _(pl):
orders = pl.DataFrame({"order_id": [1, 2, 3], "total": [42.5, 18.0, 7.25]})
customers = pl.DataFrame({"customer_id": [10, 11], "name": ["Ada", "Grace"]})
order_items = pl.DataFrame({"order_id": [1, 1, 2], "sku": ["A-1", "B-2", "A-1"]})
return customers, order_items, orders
if __name__ == "__main__":
app.run()
Run the notebook, open the Variables panel, and type orders (with a trailing space), then just a space, into "Search tables...".