rusackas commented on code in PR #44208:
URL: https://github.com/apache/superset/pull/44208#discussion_r3998425577
##########
superset-frontend/src/components/ListView/utils.ts:
##########
@@ -282,26 +271,28 @@ export function useListViewState({
selectedFlatRows,
toggleAllRowsSelected,
state: { pageIndex, pageSize, sortBy, filters },
- } = useTable(
+ } = useTable<D>(
{
- columns: columnsWithFilter,
+ // ListViewColumn is intentionally looser than react-table's own
+ // Column<D> (see its definition for why); react-table only reads
+ // these fields at runtime and doesn't care about the stricter typing.
+ columns: columnsWithFilter as unknown as Column<D>[],
data,
disableFilters: true,
disableSortRemove: true,
- initialState: initialState as any,
+ initialState,
Review Comment:
That's existing react-table behavior, not something this PR touches, it only
dropped the `as any` cast around `initialState`. No behavior change here.
##########
superset-frontend/src/components/ListView/ListView.tsx:
##########
@@ -667,10 +670,10 @@ export function ListView<T extends object = any>({
bulkSelectEnabled={bulkSelectEnabled}
selectedFlatRows={selectedFlatRows}
toggleRowSelected={(rowId, value) => {
- const row = rows.find((r: any) => r.id === rowId);
+ const row = rows.find(r => r.id === rowId);
if (row) {
prepareRow(row);
- (row as any).toggleRowSelected(value);
+ row.toggleRowSelected(value);
}
Review Comment:
That mapping lives in `TableCollection/utils.tsx`'s `mapRows`, untouched
here, this PR just retyped the callback signature. Worth its own look, but out
of scope for a typing-only refactor.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]