marimo-team / marimo

A reactive notebook for Python β€” run reproducible experiments, execute as a script, deploy as an app, and version with git.
https://marimo.io
Apache License 2.0
5.39k stars 158 forks source link

improvement: Server-side sorting for mo.ui.table #1581

Closed wasimsandhu closed 3 weeks ago

wasimsandhu commented 4 weeks ago

πŸ“ Summary

Moves column sorting to the backend for mo.ui.table, enabling full table sort per #1573.

πŸ” Description of Changes

⏰ To Do

πŸ“‹ Checklist

πŸ“œ Reviewers

@akshayka AND @mscolnick

vercel[bot] commented 4 weeks ago

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Comments Updated (UTC)
marimo-docs βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jun 11, 2024 10:08pm
marimo-storybook βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jun 11, 2024 10:08pm
wasimsandhu commented 3 weeks ago

Screenshot 2024-06-10 at 6 40 09β€―PM

wasimsandhu commented 3 weeks ago

Summarizing how I'm blocked here after moving the sort state and function call to LoadingDataTableComponent.

Currently, LoadingDataTableComponent is rendered when the given data prop is of type string (CSV urls for large data). It then renders DataTableComponent. The sorting state is passed like:

SortingState pair -> LoadingDataTableComponent -> DataTableComponent -> DataTable

The problem is that DataTableComponent can be conditionally rendered when data is not a file url but contains the actual data, which means this component needs to 1) be able to call the sort function itself, and 2) do it without interfering with a possible upstream LoadingDataTableComponent.

I think the solution here is to get rid of Loading and merge the loading logic into DataTableComponent, but I don't want to perform that refactoring in case there was a specific reason to have two components instead of one.

wasimsandhu commented 3 weeks ago

Adding some unit tests, brb.

github-actions[bot] commented 3 weeks ago

πŸš€ Development release published. You may be able to view the changes at https://marimo.app?v=0.6.18-dev9

wasimsandhu commented 3 weeks ago

Woohoo!