icflorescu / mantine-datatable

The table component for your Mantine data-rich applications, supporting asynchronous data loading, column sorting, custom cell data rendering, context menus, nesting, Gmail-style batch row selection, dark theme, and more.
https://icflorescu.github.io/mantine-datatable/
MIT License
911 stars 66 forks source link

Infinite loop problem in table #605

Closed igomest closed 3 months ago

igomest commented 3 months ago

Describe the bug In my table component, an infinite loop is happening when rendering the component.

I tried commenting out all the props I'm passing, lifecycle methods, etc., even the columns objects, but the problem persists.

When I commented out the DataTable, the loop stopped happening.

I also noticed that on the library's official website, a loop is happening in a similar way to what happens to me.

Have there been any bugs recently that are being resolved?

Screenshots If applicable, add screenshots to help explain your problem. Captura de tela 2024-06-19 150636

gabrielmaldi commented 3 months ago

Can confirm this is a bug in 7.10.3 and not in 7.10.2, just tested my app with both versions. Also happens in, for example, https://icflorescu.github.io/mantine-datatable/examples/overriding-the-default-styles

CHR-onicles commented 3 months ago

Same problem with several other examples on the website like:

etc. I can't even go through the docs properly to use this library.

Browser: Edge v126.0.2592.61 OS: Win 11 Mantine Datatable version: 7.10.3

gabrielmaldi commented 3 months ago

Tagging @icflorescu for visibility. Mantine DataTable is effectively unusable as of version 7.10.3. And the docs site is broken due to the same reason. Maybe revert changes after 7.10.2 and publish a new 7.10.4 version while trying to figure out what's broken? Thanks!

laugri commented 3 months ago

Same here. I can't access expanding-rows doc for example and quickly get extremely high CPU usage from the page.

icflorescu commented 3 months ago

Thank you all for reporting and apologies for being unable to properly address it in a timely manner due to a personal issue: my mother is still in the hospital following a stroke, I haven't slept properly for more than a week, and I simply don't have mental energy and resources at the moment... There's hope that the situation will improve soon.

I'll revert the PR that's causing this and publish 7.10.4 today.

@gfazioli, can you please have a look when you find a moment?... thanks!

gabrielmaldi commented 3 months ago

@icflorescu, I’m deeply sorry to hear about your mom. My thoughts are with you and your family. And thanks a lot for taking the time for this. ♥️

icflorescu commented 3 months ago

Thanks for the kind words, @gabrielmaldi. 7.10.4 is now published.

gabrielmaldi commented 3 months ago

Can confirm that 7.10.4 is working perfectly for me. Thanks!

CHR-onicles commented 3 months ago

@icflorescu Sorry to hear that, I'll keep her in my prayers 🙏🏼 Wishing her a speedy recovery and strength for your family. Thank you for your good work.

gfazioli commented 3 months ago

@icflorescu I'm sorry to hear about your situation. Please take care of yourself and your mother. I'm here for you if you need anything. Wishing for a speedy recovery for your mother.

gfazioli commented 3 months ago

@icflorescu I was able to fix the "edge" case - PR

The issue was due to the default key used to store the order, size, and toggling of the columns. In particular, it involved the documentation where there are multiple DataTables on the same view.

The default value created an infinite loop when having multiple DataTables on the same view. This was because using the same key, the data was always read and written to the same storage. Now, if the key is undefined, no data is written, indicating that the resizing, sizing, or sorting functions on the columns are not being used.