Skip to content

PF 4 Table updates even if arrived data haven't changed values #1399

@idevat

Description

@idevat

In our application, data are periodically reloaded from backend and then re-displayed. But often the data values remains the same.

The content of tbody element in DOM is always updated even if data in attribute rows stay the same
when I use the Table component.

Let's say we have the following code:

import React from "react";
import { Table, TableHeader, TableBody } from "@patternfly/react-table";

const Nodes = ({ nodeList }) => {
  console.log(nodeList);
  return (
    <Table
      aria-label="Cluster nodes" 
      rows={nodeList.map(node => [node.name, node.status])}
      cells={["Name", "Status"]}
    >
      <TableHeader />
      <TableBody />
    </Table>
  );
};

export default Nodes;

The console shows that we get the same data:

(3) [{…}, {…}, {…}]
0: {name: "node-1", status: "online"}
1: {name: "node-2", status: "online"}
2: {name: "node-3", status: "offline"}
length: 3
__proto__: Array(0)

(3) [{…}, {…}, {…}]
0: {name: "node-1", status: "online"}
1: {name: "node-2", status: "online"}
2: {name: "node-3", status: "offline"}
length: 3
__proto__: Array(0)

But the DOM elements inspector indicates that content of tag tbody element is updated:
Before data arrives
dom_inspector_before

After data arrives
dom_inspector_after

Version of @patternfly/react-table is 1.0.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions