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

Fix an error that makes the width value string very long. #2441

Closed
wants to merge 2 commits into from

Conversation

JongtaekChoi
Copy link

@JongtaekChoi JongtaekChoi commented Sep 10, 2020

Related Issue

#2381
#2433 (not sure)

Description

columnDef.tableData.widthmay be defined even if columnDef.width is undefined.
Because the calculated tableData.width added to each column object when the props updated or added.
This function produces a string value with a previously calculated value each time it is called, so the length increases proportionally to the power of the number of columns with has undefined width.
스크린샷 2020-09-11 오전 2 03 40

@JongtaekChoi JongtaekChoi requested a review from mbrn as a code owner September 10, 2020 17:09
Copy link

@cdruck cdruck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lines 87 and 88 are inconsistent

@JongtaekChoi
Copy link
Author

JongtaekChoi commented Sep 17, 2020

@cdruck
Thanks for your review. I updated my code recently.
How about this way?

Copy link

@joacub joacub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does not work still the bug

Copy link

@joacub joacub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the problem is this:
OLD WRONG:

columnDef.tableData = {
        columnOrder: index,
        filterValue: columnDef.defaultFilter,
        groupOrder: columnDef.defaultGroupOrder,
        groupSort: columnDef.defaultGroupSort || 'asc',
        width: typeof columnDef.width === 'number' ? `${columnDef.width}px` : columnDef.width,
        initialWidth: typeof columnDef.width === 'number' ? `${columnDef.width}px` : columnDef.width,
        additionalWidth: 0,
        id: index,
       ...columnDef.tableData, //  <------------------------------------  Mutable data overwrite the width
      };
columnDef.tableData = {
        ...columnDef.tableData, // <------------------------------------  Now mutable data is overwrites by the next code
        columnOrder: index,
        filterValue: columnDef.defaultFilter,
        groupOrder: columnDef.defaultGroupOrder,
        groupSort: columnDef.defaultGroupSort || 'asc',
        width: typeof columnDef.width === 'number' ? `${columnDef.width}px` : columnDef.width,
        initialWidth: typeof columnDef.width === 'number' ? `${columnDef.width}px` : columnDef.width,
        additionalWidth: 0,
        id: index,
      };

@justrhysism
Copy link

I applied this patch manually and it resolved the issue from what I could see.

@stale
Copy link

stale bot commented Feb 14, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.

@stale stale bot added the wontfix This will not be worked on label Feb 14, 2021
@stale stale bot closed this Feb 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants