Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data Table: Table with pagination bar breaks when 'data' is null/undefined #2848

Open
GCHQ-Developer-299 opened this issue Dec 2, 2024 · 0 comments · Fixed by #2855
Open
Labels
type: bug 🐛 Something isn't working

Comments

@GCHQ-Developer-299
Copy link
Contributor

GCHQ-Developer-299 commented Dec 2, 2024

Summary of the bug

When a data table has the 'data' prop set to null/undefined normally it displays the "No Data" state.
However, when there's a pagination bar it throws an error:

TypeError: Cannot read properties of null (reading 'length') at DataTable.render (ic-data-table.tsx:1902:1)
and the table fails to update.

Intended behaviour

For the data table to display the No Data message, and for the pagination bar to display without error.

🪜 How to reproduce

Tell us the steps to reproduce the problem:

  1. In the story-data.ts for canary-web-components ic-data-table, modify the 'updateRows200Btn' event listener in the Dev Area example as below:
updateRows200Btn.addEventListener("click", () => {
    setTimeout(() => {
      dataTable.data = null;
    }, 500);
  });
  1. The storybook example will break when you click the Update Data Rows: 200 button.
@GCHQ-Developer-299 GCHQ-Developer-299 added the type: bug 🐛 Something isn't working label Dec 2, 2024
jw18968 added a commit to jw18968/ic-ui-kit that referenced this issue Dec 3, 2024
…tems prop to zero if data is null

Use optional chaining to default ic-pagination-bar totalItems prop to zero if data is
null/undefined. Mark ic-data-table data prop as optional.
jw18968 added a commit to jw18968/ic-ui-kit that referenced this issue Dec 3, 2024
…op as optional

Mark ic-data-table data prop as optional.
jw18968 added a commit to jw18968/ic-ui-kit that referenced this issue Dec 4, 2024
…data prop as optional

Mark ic-data-table data prop as optional.
GCHQ-Developer-112 added a commit that referenced this issue Dec 4, 2024
…s prop to zero if data is null

Use optional chaining to default ic-pagination-bar totalItems prop to zero if data is
null/undefined. Mark ic-data-table data prop as optional.
GCHQ-Developer-112 added a commit that referenced this issue Dec 4, 2024
…a prop as optional

Mark ic-data-table data prop as optional.
GCHQ-Developer-847 pushed a commit that referenced this issue Dec 9, 2024
…s prop to zero if data is null

Use optional chaining to default ic-pagination-bar totalItems prop to zero if data is
null/undefined. Mark ic-data-table data prop as optional.
GCHQ-Developer-847 pushed a commit that referenced this issue Dec 9, 2024
…a prop as optional

Mark ic-data-table data prop as optional.
GCHQ-Developer-847 pushed a commit that referenced this issue Dec 9, 2024
…s prop to zero if data is null

Use optional chaining to default ic-pagination-bar totalItems prop to zero if data is
null/undefined. Mark ic-data-table data prop as optional.
GCHQ-Developer-847 pushed a commit that referenced this issue Dec 9, 2024
…a prop as optional

Mark ic-data-table data prop as optional.
GCHQ-Developer-847 pushed a commit that referenced this issue Dec 9, 2024
…s prop to zero if data is null

Use optional chaining to default ic-pagination-bar totalItems prop to zero if data is
null/undefined. Mark ic-data-table data prop as optional.
GCHQ-Developer-847 pushed a commit that referenced this issue Dec 9, 2024
…a prop as optional

Mark ic-data-table data prop as optional.
GCHQ-Developer-847 pushed a commit that referenced this issue Dec 9, 2024
…s prop to zero if data is null

Use optional chaining to default ic-pagination-bar totalItems prop to zero if data is
null/undefined. Mark ic-data-table data prop as optional.
GCHQ-Developer-847 pushed a commit that referenced this issue Dec 9, 2024
…a prop as optional

Mark ic-data-table data prop as optional.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 Something isn't working
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

1 participant