Skip to content

Export the Toast compound, and correct the table docs - #280

Merged
pathscale merged 1 commit into
masterfrom
fix/toast-export-and-table-docs
Aug 31, 2026
Merged

Export the Toast compound, and correct the table docs#280
pathscale merged 1 commit into
masterfrom
fix/toast-export-and-table-docs

Conversation

@pathscale

@pathscale pathscale commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Two things consumers hit while porting an application to 2.11.x.

Toast was the toast function

dist/index.js carried

index_js_toast as Toast, index_js_toast as toast

Both names resolved to the same binding, so Toast in the built package was the toast() function. Toast.Provider, Toast.Content and every other compound member were undefined, and mounting <Toast.Provider /> threw Comp is not a function, which takes the whole application down before first render.

The source was correct: Toast.generated.tsx builds Object.assign(ToastRoot, { Provider, Content, ... }) and exports it as the default. What was wrong is the shape of the re-export. The root exported default as Toast from ./components/toast in the same block as that module's named toast, and flattening collapsed the two onto one binding. Compare Button, which survives as a plain pass-through because nothing in its block collides.

Naming the compound at the component barrel and re-exporting that name keeps them apart. Verified in the built output: Toast and toast are separate entries, dist/components/toast/index.js carries default as Toast, and that default is the Object.assign result.

The table docs pointed at hooks that no longer exist

useTableModel, useTableSorting, useTablePagination, useTableFiltering, useTableExpansion, useTableSelection and useVirtualRows all went out with TanStack. None are exported from src/index.ts any more. But docs/component-migration-map.md still told anyone migrating off EnhancedTable and StreamingTable to "use Table with the table hooks", and docs/ui-usage.md still taught useTableModel as the way to assemble a table, complete with a worked example.

Both now point where the replacements actually are:

  • EnhancedTable → DataGrid with createDataGrid
  • StreamingTable → FlexGrid with createFlexGrid, fed by useStreamingBuffer
  • the Table section → createDataGrid, for the case where a consumer genuinely needs markup DataGrid cannot draw

The Table section also now says what the grid model deliberately does not own: presentation state such as which filter popover is open, or which rows a bespoke table has expanded. A consumer keeping its own markup owns that, and should key expansion by row id rather than index so sorting or paging does not leave the wrong row open. That was learned the hard way porting one application's five bespoke tables.

Not in this PR

Two related defects, both verified but fixed elsewhere or still open:

  • AuthCard rendered its footer twice and PasswordField delivered the raw InputEvent to an onInput it types as (value: string) => void. Both are the same upstream cause, a compiled component's own props also being spread onto its root element, and both are fixed by Claim the props a component declares as its own, and add the working agreement solid-layouts#11. Confirmed end to end by building this package against that branch and running the consuming application without either workaround.
  • <Toast.Provider> still does not resolve through the layouts application plugin. With the plugin disabled the tag compiles correctly against the fixed export; with it enabled the compound is rewritten to the wrong binding. That is a plugin issue rather than a packaging one, and the flat ToastProvider export, which this repo's own migration note already recommends, works today. Tracked as Layouts plugin misresolves compound tags like <Toast.Provider> solid-layouts#13.

Verification

tsc --noEmit clean. biome check clean on both changed source files; src/index.ts has a pre-existing whole-file export-sort finding on master that this PR does not touch, to avoid several hundred lines of unrelated churn. Built with rslib build and the resulting entry inspected directly.

`Toast` in the built entry was the toast *function*, not the component.
`dist/index.js` carried

    index_js_toast as Toast, index_js_toast as toast

so both names resolved to the same binding, and `Toast.Provider`,
`Toast.Content` and every other compound member were undefined for anyone
consuming the package.

The source was right; the shape of the re-export was not. The root exported
`default as Toast` from `./components/toast` in the same block as that
module's named `toast`, and flattening collapsed the two. Naming the compound
at the component barrel instead, and re-exporting that name, keeps them
apart: `Toast` and `toast` are now separate entries in the built output and
`Toast` reaches `Object.assign(ToastRoot, { Provider, ... })` as intended.

The docs described a table model that no longer exists. `useTableModel`,
`useTableSorting`, `useTablePagination`, `useTableFiltering`,
`useTableExpansion`, `useTableSelection` and `useVirtualRows` all went out
with TanStack, but the migration map still pointed `EnhancedTable` and
`StreamingTable` at them and the usage guide still taught them as the way to
assemble a table. Anyone following either one walked into a wall.

They now point where the replacements actually are: `EnhancedTable` at
DataGrid with `createDataGrid`, `StreamingTable` at FlexGrid with
`createFlexGrid` fed by `useStreamingBuffer`, and the Table section at
`createDataGrid` for the case where a consumer genuinely needs its own
markup -- with a note that the grid model deliberately does not own
presentation state such as which filter popover is open or which rows a
bespoke table has expanded, so a consumer keeping its own markup owns that
and should key expansion by row id rather than index.
@pathscale
pathscale merged commit 36b076c into master Aug 31, 2026
1 check passed
@pathscale
pathscale deleted the fix/toast-export-and-table-docs branch August 31, 2026 09:40
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.

1 participant