Material-table: isLoading doesn't work properly

Created on 21 May 2019  路  2Comments  路  Source: mbrn/material-table

Describe the bug
If you use the isLoading prop in conjunction with data, the table crashes and says the data can't be null

To Reproduce
Steps to reproduce the behavior:

  1. Make a table with data={tableDataVar}
  2. Set the isLoading prop to isLoading={!tableDataVar}
  3. An error appears saying that data must not be null

Expected behavior
The error should not appear if the isLoading value is set to true

help wanted

Most helpful comment

Hi @jakeleventhal ,

This is not a bug. You should set a empty array to data. If you want to loading animation you can use data.length === 0 or use another flag on state.

All 2 comments

Set your state鈥檚 data prop to an empty array. You have a table in your UI expecting it to have data at some point in the form of an array, if the array is empty material-table shows your users a nice no data message which you can also override with localization. For state expecting an array of values generally I have seen you set it to an empty array with initialState.

Hi @jakeleventhal ,

This is not a bug. You should set a empty array to data. If you want to loading animation you can use data.length === 0 or use another flag on state.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

behrouz-s picture behrouz-s  路  3Comments

ModPhoenix picture ModPhoenix  路  3Comments

KKrisu picture KKrisu  路  3Comments

terapepo picture terapepo  路  3Comments

diegosps picture diegosps  路  3Comments