The table seems to display some sort of cached data from the previous render when using completely custom pagination
Describe the bug I am using completely custom pagination (Nothing to do with pagination factory). "react-bootstrap-table-next": "^4.0.1", "react": "16.13.1"
I have my custom pagination buttons that dispatch actions, fetch data and modify the data prop of the table. So the only thing the table has to worry is showing the new data on data change.
In my case I have next and prev buttons. Whenever I click them, a call is made, 10 new items are fetched and passed to the table via the data prop. But the table shows 11 entries. It retains 1 entry from the previous page. It shows the entry as the first row of the table.
One thing to note is that the problem is only in the rendering. I have used react devtools and tracked the props all the way to the table to check what the bootstrap table receives as data prop, and it does receive the correct 10 entries. During rendering I am not sure from where it is retaining some previously rendered rows.
To Reproduce Steps to reproduce the behavior:
- Just use the normal react-bootstrap-table without the pagination tools or and other toolkits.
- Show 10 rows initially
- Click on an action button, make an API call and completely change the data array to new data. (Not only a cell. Change the entire data set).
- You will see that it does not show only the 10 new entries, but it shows 11. It retains one entry from the previous render.
- The next time you change the data, it will show 12 entries.
Issue 1360 seems to be very similar. But in his case there is an empty row, and in my case it's a row from the previous data set.
Probably a duplicate key from the data you are fetching. Could be related to this https://github.com/react-bootstrap-table/react-bootstrap-table2/issues/1421
@vinodbhavnani would you please make a small and minimal example on codesandbox so that we can help you more efficient, many thanks
@vinodbhavnani is this issue resolved?
@vaidehi2000 it was as @elocin11 mentioned. The key had duplicates. I had a huge dataset so it was hard to realise. Closing this now.
Okay. Thank you
I'm implementing search on my api data using react-bootstrap table. but one of my data is using " " while rendering, as it is not there in my fetched data. it is preventing that particular data from being searched in the table. what might be the reason, how to resolve it.