-
Notifications
You must be signed in to change notification settings - Fork 62
fix(common): table unsorting will be in descending order #2107
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(common): table unsorting will be in descending order #2107
Conversation
@@ -250,7 +250,7 @@ function WrappedTable<T extends object = any>({ | |||
); | |||
}, [allColumns, sorterMenu, sort, onRow]); | |||
|
|||
let data = [...dataSource] as T[]; | |||
let data = (dataSource && [...dataSource]) || ([] as T[]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let data: T[] = dataSource ? [...dataSource]) : []
@@ -283,7 +283,7 @@ function WrappedTable<T extends object = any>({ | |||
size="small" | |||
pagination={false} | |||
onChange={onChange} | |||
dataSource={data} | |||
dataSource={data || []} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
u set default value above.
@@ -60,7 +60,7 @@ function WrappedTable<T extends object = any>({ | |||
pagination: paginationProps, | |||
onChange, | |||
slot, | |||
dataSource = [], | |||
dataSource, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont understand why remove this default value. Then leads code below has to be like dataSource?.length || 0
a081a4c
to
fb76c04
Compare
fb76c04
to
4e28e0e
Compare
/approve |
/cherry-pick release/1.5-alpha1 |
Automated cherry pick failed, please resolve the confilcts and create PR manually.
|
1.5-alpha2 will be released today, not need to pick. |
What this PR does / why we need it:
Fix bug of table unsorting will be in descending order.
Does this PR introduce a user interface change?
❎ No
ChangeLog
Does this PR need be patched to older version?
✅ Yes(version is required)
release/1.5-alpha1
Which issue(s) this PR fixes:
Fixes # https://erda-org.erda.cloud/erda/dop/projects/387/issues/all?id=252476&issueFilter__urlQuery=eyJzdGF0ZXMiOls0NDAyLDcxMDQsNzEwNSw0NDAzLDQ0MDQsNzEwNiw0NDA2LDQ0MDcsNDQxMiw0NTM4LDQ0MTMsNDQxNCw0NDE1LDQ0MTZdLCJhc3NpZ25lZUlEcyI6WyIxMDAxMjE0Il19&issueTable__urlQuery=eyJwYWdlTm8iOjEsICJwYWdlU2l6ZSI6MTB9&issueViewGroup__urlQuery=eyJ2YWx1ZSI6ImthbmJhbiIsImNoaWxkcmVuVmFsdWUiOnsia2FuYmFuIjoiZGVhZGxpbmUifX0%3D&iterationID=680&type=BUG