Skip to content

Commit

Permalink
fix flickering on empty table refresh (#2277)
Browse files Browse the repository at this point in the history
resolves #2275

Co-authored-by: Fred Lefévère-Laoide <[email protected]>
  • Loading branch information
FredLL-Avaiga and Fred Lefévère-Laoide authored Nov 25, 2024
1 parent 4ffb798 commit e97ed37
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions frontend/taipy-gui/src/components/Taipy/PaginatedTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,8 @@ const PaginatedTable = (props: TaipyPaginatedTableProps) => {
}, [pageSizeOptions, allowAllRows, pageSize]);

const { rows, rowCount, filteredCount, compRows } = useMemo(() => {
const ret = { rows: [], rowCount: 0, filteredCount: 0, compRows: [] } as {
rows: RowType[];
const ret = { rows: undefined, rowCount: 0, filteredCount: 0, compRows: [] } as {
rows?: RowType[];
rowCount: number;
filteredCount: number;
compRows: RowType[];
Expand Down Expand Up @@ -454,7 +454,7 @@ const PaginatedTable = (props: TaipyPaginatedTableProps) => {
createSendActionNameAction(updateVarName, module, {
action: onEdit,
value: value,
index: getRowIndex(rows[rowIndex], rowIndex, startIndex),
index: rows ? getRowIndex(rows[rowIndex], rowIndex, startIndex) : startIndex,
col: colName,
user_value: userValue,
tz: tz,
Expand All @@ -469,7 +469,7 @@ const PaginatedTable = (props: TaipyPaginatedTableProps) => {
dispatch(
createSendActionNameAction(updateVarName, module, {
action: onDelete,
index: getRowIndex(rows[rowIndex], rowIndex, startIndex),
index: rows ? getRowIndex(rows[rowIndex], rowIndex, startIndex): startIndex,
user_data: userData,
})
),
Expand All @@ -481,7 +481,7 @@ const PaginatedTable = (props: TaipyPaginatedTableProps) => {
dispatch(
createSendActionNameAction(updateVarName, module, {
action: onAction,
index: getRowIndex(rows[rowIndex], rowIndex, startIndex),
index: rows ? getRowIndex(rows[rowIndex], rowIndex, startIndex): startIndex,
col: colName === undefined ? null : colName,
value,
reason: value === undefined ? "click" : "button",
Expand Down Expand Up @@ -614,7 +614,7 @@ const PaginatedTable = (props: TaipyPaginatedTableProps) => {
</TableRow>
</TableHead>
<TableBody>
{rows.map((row, index) => {
{rows?.map((row, index) => {
const sel = selected.indexOf(index + startIndex);
if (sel == 0) {
Promise.resolve().then(
Expand Down Expand Up @@ -664,7 +664,7 @@ const PaginatedTable = (props: TaipyPaginatedTableProps) => {
</TableRow>
);
})}
{rows.length == 0 &&
{!rows &&
loading &&
Array.from(Array(30).keys(), (v, idx) => (
<TableRow hover key={"rowSkel" + idx}>
Expand Down

0 comments on commit e97ed37

Please sign in to comment.