-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
DataTable: Column resize is not working properly. #4471
Comments
Agreed that is weird as its working in StackBlitz: https://stackblitz.com/edit/react-11cbe3?file=src%2FApp.js |
Yes so this is the same thing happening in my app. So in dev mode in nextjs this does not have an issue and works properly but in production mode it seems something happens maybe during the optimization process that breaks the behavior of the resize. I haven't been able to debug this further. |
@dmacannuco what was the previous version you were at before you upgraded? |
@bu3alwa this probably has to do with REact 18 Strict mode. Using the PR Showcase just change reactStrictMode: false, //process.env.NODE_ENV === 'production' ? false : true, And I bet you see the same behavior now as production mode. That will help narrow down the issue to improper hook usage. |
This issue might be a bit on my lower priority for next week but Ill check the week after and let you know what I can find. |
The version from which we have updated has been from 8.3.0. |
ok I know whats causing it but I don't know where its happening and why. So on the I am unsure where in the code that is set so if you can let me know I can debug further. |
Hey @bu3alwa, I've already fixed it and created a PR(#4410) for this issue. It has been approved by @melloware but waiting to get approved by other reviewers and get merged. You can check it and test it you want. |
I think yours would run into the same issue. On load the attribute is missing. primereact/components/lib/datatable/DataTable.js Line 1343 in eac31f5
This is where the id is generated but I have to check how its passed to the prop. Ill check more tomorrow Edit This is possibly where it started when it was switched from state to ref. Unsure though. |
ok, this was bothering me so
This would be a fix but I dunno if it has any sideeffects. @melloware do you think this is safe to add? or would that break anything else? |
Let me look at this. I thought you couldn't have a Hook listen on a ref.current? Refs don't trigger re-renders right? |
OK fixed submitted for this issue. It had to do with mounting the component properly. |
Fixed in 9.6.2 if you want to give it a try |
I just tested it and everything seems to work fine. |
Describe the bug
The resize of the columns of the DataTable component is not working correctly when we have updated to the latest version of the 9.5.0 primereact library.
The error is the same as the example on the official documentation page (https://primereact.org/datatable/)
The error is reproduced in both columnResizeMode.
In "expand" mode the column place is not correct and also the resize of one column affects the rest.
error_expand_mode.webm
In "fit" mode, the resize directly does not work.
error_fit_mode.webm
The most curious thing is that if we try to run the code in the sandbox, in both cases, it seems to work correctly in a simplified project.
However, the same thing happens in our project as is happening in the examples on the documentation website.
Reproducer
No response
PrimeReact version
9.5.0
React version
18.x
Language
ES6
Build / Runtime
Create React App (CRA)
Browser(s)
No response
Steps to reproduce the behavior
No response
Expected behavior
No response
The text was updated successfully, but these errors were encountered: