table: Add ranged dumps for batched export (#2755)
Closes #2754 ## Description `TableState::dump_range` lets callers materialize a selected row range while preserving the existing full-table `dump` API. The requested range is clamped to the delegate's current row count so applications can iterate over large tables in fixed-size batches. The DataTable story now prompts for the destination before reading table data, then materializes 2,000 rows at a time on the foreground GPUI context. A capacity-one channel sends those batches to one background `csv::Writer<File>`, which streams directly to disk without accumulating the complete table, CSV buffer, or `String` in memory. `TableState::dump` remains an eager whole-table API for compatibility. Large data exporters should use `dump_range` with an application-level batch size. Progress UI, cancellation, remote pagination, and delegate changes remain outside this PR. ## Screenshot Not applicable. This changes export scheduling and file I/O rather than the rendered table UI. ## How to Test ```sh cargo fmt --all -- --check cargo test -p gpui-component --test table_dump_range cargo test -p gpui-component cargo check -p gpui-component-story RUSTC_BOOTSTRAP=1 cargo check \ -p gpui-component-story-web \ --target wasm32-unknown-unknown ``` Observed results: - formatting passed; - both `table_dump_range` tests passed; - the complete `gpui-component` test suite passed; - the native story crate compiled successfully; - the WASM story check passed after enabling the unstable feature required by the current `wasm_thread` dependency (`RUSTC_BOOTSTRAP=1`); a plain stable check stops in that dependency with `E0554` before compiling the story; - the DataTable story opened its save dialog before export work; cancelling produced no output, while exporting the default table produced one header and 5,000 records with 45 columns each; - the first exported record had ID `0`, the last had ID `4999`, and the CSV parsed successfully with consistent column counts. The ranged dump regression tests verify that `dump_range(98..103)` is clamped to a 100-row table and only calls `cell_text` for rows 98 and 99, while the existing `dump(cx)` still returns the complete table. ## AI Assistance AI assisted with root-cause analysis, implementation, test design, validation planning, and PR wording. I reviewed the final diff and ran the checks listed above. ## Checklist - [x] I have read the [CONTRIBUTING](../CONTRIBUTING.md) document and followed the guidelines. - [x] Reviewed the changes in this PR and confirmed AI-generated code is accurate. - [x] Passed `cargo run` for story tests related to the changes. - [ ] Tested macOS, Windows, and Linux platform performance (not platform-specific). --------- Co-authored-by: Floyd Wang <gassnake999@gmail.com>
L
luren committed
1a2741411fe8f7556dbb572fa7cce8d9e5a8f36b
Parent: c6ffd3e
Committed by GitHub <noreply@github.com>
on 8/21/2026, 5:53:53 AM