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

New columns don't appear when added to useDataTableColumns #596

Closed
techied opened this issue May 17, 2024 · 14 comments
Closed

New columns don't appear when added to useDataTableColumns #596

techied opened this issue May 17, 2024 · 14 comments
Labels
help wanted Extra attention is needed

Comments

@techied
Copy link

techied commented May 17, 2024

Describe the bug
When using the useDataTableColumns hook (as described in the Column Toggling Example), new columns added to the columns prop do not appear (in the table or in effectiveColumns) until resetColumnsOrder is called (or the local storage key ${key}-columns-order is cleared)

To Reproduce
Steps to reproduce the behavior:

  1. Copy the Column Toggling Example
  2. Load the page
  3. Add a column to the columns prop (one which has not been used before)
  4. Observe that the new column does not appear

Expected behavior
The column should appear

Screenshots
Happy to provide a screen recording if helpful in reproducing the issue

Desktop (please complete the following information):

  • OS: macOS
  • Browser Chrome
  • Version 124
@nicobermudez
Copy link

Bump. I'm running into this same issue

@icflorescu
Copy link
Owner

Thanks for raising the issue.
Due to some family issues I won't have any spare time over the next week, so I'd be more than grateful if anyone else is willing to take a look at this. @gfazioli, maybe? :-)

@icflorescu icflorescu added the help wanted Extra attention is needed label Jun 15, 2024
@gfazioli
Copy link
Contributor

@nicobermudez Thank you for reporting. I'll try to replicate that and investigate

@devkoller
Copy link

I have same issue!

wating for @gfazioli pull request will merge to update mantine datatable.

@gfazioli
Copy link
Contributor

I have same issue!

wating for @gfazioli pull request will merge to update mantine datatable.

PR ready, waiting for @icflorescu approval/merge/release

icflorescu added a commit that referenced this issue Jun 18, 2024
New columns don't appear when added to useDataTableColumns #596
icflorescu added a commit that referenced this issue Jun 18, 2024
@icflorescu
Copy link
Owner

Thanks a lot for taking the time, @gfazioli, you're a star!
This will do for now; I'm not yet able to get back to work, but everything seems to be working, so the fix went into 7.10.3.

@techied
Copy link
Author

techied commented Jun 18, 2024

Thank you @gfazioli !

@nicobermudez
Copy link

Thank you for the work on this! Will really help us next few weeks 👍

@techied
Copy link
Author

techied commented Jun 18, 2024

Hi @gfazioli , just got around to testing this and it seems like columns are appearing as intended, although the order of the columns passed in to useDataTableColumns is not respected until resetColumnsOrder is called.

My use case does not require column ordering

I wonder if these 2 separate concerns (toggling columns and ordering columns) would be better served by 2 separate hooks? That way the complexity could be reduced

@icflorescu icflorescu reopened this Jun 24, 2024
@icflorescu
Copy link
Owner

Sorry everyone, this issue is now reopened due to a different regression introduced by the fix.
Due to a personal issue - my mother recovering in the hospital after a stroke, I haven't slept properly for more than a week and I simply don't have any mental energy and resources left at the moment.

Hopefully @gfazioli or someone else will be able to come up with a new solution soon.

For the benefit of the project/community, I'd be more than grateful for any help maintaining this project over the next couple of weeks 😫🙏

@mikkurogue
Copy link

If I have time, I can also take a look at the issue if @gfazioli or @icflorescu do not have the time.

@gfazioli
Copy link
Contributor

gfazioli commented Jun 26, 2024

If I have time, I can also take a look at the issue if @gfazioli or @icflorescu do not have the time.

you mean #605?
if yes, i was able to create a PR #608

@icflorescu
Copy link
Owner

Thanks again, @gfazioli! Your PR was released in 7.11.0. The code in useDataTableColumns.ts definitely needs some cleanup; it would be nice if you, @mikkurogue, could also take a look at it when you have some spare time.

Please make your PRs against the next branch.

Thank you all!

I'll close thisfor now, please feel free to reopen and come up with PRs if necessary.

@mikkurogue
Copy link

@icflorescu
On first glance, after reading useDataTableColumns.ts, I can't necessarily see much "wrong" other than potential performance increases from the runtime but I'm doubtful this would provide much value in the grand scheme of things. I can still provide a PR later if you feel like looking over it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants