Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(list): fix error reported due to incorrect paginator parameters (#…
…39681) * fix(list): fix pagination parameter error * test: add case * test: update snapshot * chore: update case * feat(util): add mergeProps ref: https://github.com/ant-design/ant-design-mobile/blob/3c87f1c5b16c39c70e494159732f6bb1f0a08c01/src/utils/with-default-props.tsx#L5 * chore: replace method * chore: rename
- Loading branch information
Showing
5 changed files
with
149 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
type RecordType = Record<string, any>; | ||
|
||
function extendsObject<T extends RecordType>(...list: T[]) { | ||
const result: RecordType = { ...list[0] }; | ||
|
||
for (let i = 1; i < list.length; i++) { | ||
const obj = list[i]; | ||
if (obj) { | ||
Object.keys(obj).forEach((key) => { | ||
const val = obj[key]; | ||
if (val !== undefined) { | ||
result[key] = val; | ||
} | ||
}); | ||
} | ||
} | ||
|
||
return result; | ||
} | ||
|
||
export default extendsObject; |
93 changes: 93 additions & 0 deletions
93
components/list/__tests__/__snapshots__/pagination.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters