Virtual scrolling breaks when showing new row
barucAlmaguer opened this issue · comments
Hi, I just found an issue when triggering the "show new row" action on a virtualized table.
You can easily reproduce the case with the default virtualized example from ka-table docs:
And triggering the action like this in the body of the Component:
// ADD THIS:
import { showNewRow } from 'ka-table/actionCreators'
const ManyRowsDemo: React.FC = () => {
const [tableProps, changeTableProps] = useState(tablePropsInit);
const dispatch: DispatchFunc = (action) => {
changeTableProps((prevState: ITableProps) => kaReducer(prevState, action));
};
// ADD THIS:
useEffect(() => {
dispatch(showNewRow())
}, [])
return (
<>
<Table
{...tableProps}
dispatch={dispatch}
/>
</>
);
};
result:
I think the problem is that the virtualization code doesn't take into account that a "create new row" may be as the top row, and it should subtract it's height to the total "virtual row" it puts on top
Hi @barucAlmaguer thank you! I have reproduced that and will fix it this week
the issue was fixed in 7.6.2
version
demo https://stackblitz.com/edit/table-many-rows-ts-akyv2v?file=Demo.tsx
Thanks!
I'll check it out 😄
@komarovalexander hi there, I'm helping @barucAlmaguer test this bug fix we stumbled upon a funny type error.
error TS2551: Property 'UpdateTreeGroupsExpanded ' does not exist on type 'Partial<Record<"ClearFocused" | "ClearSingleAction" | "CloseEditor" | "CloseRowEditors" | "DeleteRow" | "DeselectAllFilteredRows" | "DeselectAllRows" | "DeselectAllVisibleRows" | "DeselectRow" | ... 49 more ... | "Validate", (currentProps: ITableAllProps, params?: any) => void>>'. Did you mean 'UpdateTreeGroupsExpanded'?
The ActionType
enum type has a UpdateTreeGroupsExpanded
with the value being "UpdateTreeGroupsExpanded "
with an empty space at the end.
Should I create a separate issue for this?