Export the Toast compound, and correct the table docs - #280
Merged
Conversation
`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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two things consumers hit while porting an application to 2.11.x.
Toastwas the toast functiondist/index.jscarriedBoth names resolved to the same binding, so
Toastin the built package was thetoast()function.Toast.Provider,Toast.Contentand every other compound member wereundefined, and mounting<Toast.Provider />threwComp is not a function, which takes the whole application down before first render.The source was correct:
Toast.generated.tsxbuildsObject.assign(ToastRoot, { Provider, Content, ... })and exports it as the default. What was wrong is the shape of the re-export. The root exporteddefault as Toastfrom./components/toastin the same block as that module's namedtoast, and flattening collapsed the two onto one binding. CompareButton, 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:
Toastandtoastare separate entries,dist/components/toast/index.jscarriesdefault as Toast, and that default is theObject.assignresult.The table docs pointed at hooks that no longer exist
useTableModel,useTableSorting,useTablePagination,useTableFiltering,useTableExpansion,useTableSelectionanduseVirtualRowsall went out with TanStack. None are exported fromsrc/index.tsany more. Butdocs/component-migration-map.mdstill told anyone migrating offEnhancedTableandStreamingTableto "use Table with the table hooks", anddocs/ui-usage.mdstill taughtuseTableModelas the way to assemble a table, complete with a worked example.Both now point where the replacements actually are:
EnhancedTable→ DataGrid withcreateDataGridStreamingTable→ FlexGrid withcreateFlexGrid, fed byuseStreamingBuffercreateDataGrid, for the case where a consumer genuinely needs markup DataGrid cannot drawThe 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:
AuthCardrendered itsfootertwice andPasswordFielddelivered the rawInputEventto anonInputit 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 flatToastProviderexport, 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 --noEmitclean.biome checkclean on both changed source files;src/index.tshas 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 withrslib buildand the resulting entry inspected directly.