diff --git a/.github/workflows/preview-deploy.yml b/.github/workflows/preview-deploy.yml index c0203b6da160..6ed0f06f0526 100644 --- a/.github/workflows/preview-deploy.yml +++ b/.github/workflows/preview-deploy.yml @@ -21,6 +21,7 @@ jobs: uses: dawidd6/action-download-artifact@v2 with: workflow: ${{ github.event.workflow_run.workflow_id }} + run_id: ${{ github.event.workflow_run.id }} name: pr # Save PR id to output @@ -33,7 +34,7 @@ jobs: uses: dawidd6/action-download-artifact@v2 with: workflow: ${{ github.event.workflow_run.workflow_id }} - workflow_conclusion: success + run_id: ${{ github.event.workflow_run.id }} name: site - name: upload surge service @@ -75,6 +76,7 @@ jobs: uses: dawidd6/action-download-artifact@v2 with: workflow: ${{ github.event.workflow_run.workflow_id }} + run_id: ${{ github.event.workflow_run.id }} name: pr # Save PR id to output diff --git a/.github/workflows/verify-files-modify.yml b/.github/workflows/verify-files-modify.yml index ba06cf3b1df6..e536da38fa48 100644 --- a/.github/workflows/verify-files-modify.yml +++ b/.github/workflows/verify-files-modify.yml @@ -2,7 +2,7 @@ name: Verify Files modify on: pull_request_target: - types: [opened, edited, synchronize, ready_for_review] + types: [opened, synchronize] jobs: verify: @@ -25,7 +25,8 @@ jobs: forbid-files: 'components/style/themes/default.less' skip-verify-authority: 'admin' comment: | - 🚨 Hi @${{ github.event.pull_request.user.login }}. Thanks for your contribution, as the `default.less` file is currently being upgraded, changes will not be accepted for the time being. + 🚨 Hi @${{ github.event.pull_request.user.login }}. Thanks for your contribution, as the `default.less` file is currently being upgraded, changes are not recommended. - 🚨 你好,@${{ github.event.pull_request.user.login }}。感谢你的贡献,由于 `default.less` 文件近期处于升级状态,暂不接受更改。 - close: true + 🚨 你好,@${{ github.event.pull_request.user.login }}。感谢你的贡献,由于 `default.less` 文件近期处于升级状态,不建议进行更改。 + close: false + set-failed: false diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 66e6dedc8a02..547a3062d903 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -25,6 +25,26 @@ if you have some problem, welcome to connect `taofeng.yang@shopee.com` or `lay.z --- +## 4.18.3 + +`2022-01-10` + +- 🆕 Menu support `home` and `end` keyboard navigate. [#33642](https://github.com/ant-design/ant-design/pull/33642) [@dartamonov-vertex](https://github.com/dartamonov-vertex) +- Table + - ⚡️ Improve Table perfermance significantly when mount and unmount. [#33554](https://github.com/ant-design/ant-design/pull/33554) + - 🐞 Fix Table emptynode fixed display. [#33610](https://github.com/ant-design/ant-design/pull/33610) [@hemengke1997](https://github.com/hemengke1997) + - 🐞 Fix Table tree data hover error. [#33638](https://github.com/ant-design/ant-design/pull/33638) [@LongHaoo](https://github.com/LongHaoo) +- Form + - 🐞 Fix Form validateMessages is not correct in default locale. [#33511](https://github.com/ant-design/ant-design/pull/33511) + - 🐞 Fix Form.Item help with empty string makes layout shaking. [#33644](https://github.com/ant-design/ant-design/pull/33644) +- 🐞 Fix Input.Textarea throws error on preact. [#33536](https://github.com/ant-design/ant-design/pull/33536) [@developit](https://github.com/developit) +- 🐞 Fix PageHeader state update error after unmounted. [#33546](https://github.com/ant-design/ant-design/pull/33546) [@wuifdesign](https://github.com/wuifdesign) +- 💄 Fix Select tag margin issue when using `tagRender`. [#33539](https://github.com/ant-design/ant-design/pull/33539) +- 💄 Remove svg reset style for IE9-, fix svg elements being cutting style problem. [#33579](https://github.com/ant-design/ant-design/pull/33579) +- TypeScript + - 🤖 Fix Upload types for pass generic. [#33543](https://github.com/ant-design/ant-design/pull/33543) [@woochanleee](https://github.com/woochanleee) + - 🤖 Fix Card.Grid props should expose Div Properties like `onClick`. [#33563](https://github.com/ant-design/ant-design/pull/33563) [@LongHaoo](https://github.com/LongHaoo) + ## 4.18.2 `2021-12-30` diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index c71de22354d9..f3f747088e97 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -25,6 +25,26 @@ timeline: true --- +## 4.18.3 + +`2022-01-10` + +- 🆕 Menu 组件支持 `home`(跳转到第一项)和 `end`(跳转到最后一项)的键盘操作。[#33642](https://github.com/ant-design/ant-design/pull/33642) [@dartamonov-vertex](https://github.com/dartamonov-vertex) +- Table + - ⚡️ 大幅优化 Table 渲染时和卸载时的性能。[#33554](https://github.com/ant-design/ant-design/pull/33554) + - 🐞 修复 Table 空状态未居中显示。[#33610](https://github.com/ant-design/ant-design/pull/33610) [@hemengke1997](https://github.com/hemengke1997) + - 🐞 修复 Table 树形数据展示 hover 高亮异常的问题。[#33638](https://github.com/ant-design/ant-design/pull/33638) [@LongHaoo](https://github.com/LongHaoo) +- Form + - 🐞 修复 Form 在英文语言包下错误提示文案不生效的问题。[#33511](https://github.com/ant-design/ant-design/pull/33511) + - 🐞 修复 Form.Item `help` 使用空字符串的时候布局抖动的问题。[#33644](https://github.com/ant-design/ant-design/pull/33644) +- 🐞 修复 Input.Textarea 在 preact 下报错的问题。[#33536](https://github.com/ant-design/ant-design/pull/33536) [@developit](https://github.com/developit) +- 🐞 修复 PageHeader unmounted 后报 `React state update on an unmounted component` 的错误。[#33546](https://github.com/ant-design/ant-design/pull/33546) [@wuifdesign](https://github.com/wuifdesign) +- 💄 修复 Select 使用 `tagRender` 时标签上下边距不统一的问题。[#33539](https://github.com/ant-design/ant-design/pull/33539) +- 💄 移除 svg 针对 IE9- 的重设样式,修复全局样式影响部分 svg 元素的问题。[#33579](https://github.com/ant-design/ant-design/pull/33579) +- TypeScript + - 🤖 修复 Upload 泛型定义。[#33543](https://github.com/ant-design/ant-design/pull/33543) [@woochanleee](https://github.com/woochanleee) + - 🤖 修复 Card.Grid 未能正常支持 `onClick` 的问题。[#33563](https://github.com/ant-design/ant-design/pull/33563) [@LongHaoo](https://github.com/LongHaoo) + ## 4.18.2 `2021-12-30` diff --git a/components/anchor/Anchor.tsx b/components/anchor/Anchor.tsx index 82b871267c77..851a2b965392 100644 --- a/components/anchor/Anchor.tsx +++ b/components/anchor/Anchor.tsx @@ -257,6 +257,16 @@ export default class Anchor extends React.Component ({ + registerLink: this.registerLink, + unregisterLink: this.unregisterLink, + scrollTo: this.handleScrollTo, + activeLink: link, + onClick: onClickFn, + }), + ); + render() { const { getPrefixCls, direction } = this.context; const { @@ -310,13 +320,7 @@ export default class Anchor extends React.Component ); - const contextValue = memoizeOne((link, onClickFn) => ({ - registerLink: this.registerLink, - unregisterLink: this.unregisterLink, - scrollTo: this.handleScrollTo, - activeLink: link, - onClick: onClickFn, - }))(activeLink, onClick); + const contextValue = this.getMemoizedContextValue(activeLink, onClick); return ( diff --git a/components/anchor/__tests__/cached-context.test.tsx b/components/anchor/__tests__/cached-context.test.tsx new file mode 100644 index 000000000000..0fa0db6f93b6 --- /dev/null +++ b/components/anchor/__tests__/cached-context.test.tsx @@ -0,0 +1,51 @@ +import React, { memo, useState, useRef, useContext } from 'react'; +import { mount } from 'enzyme'; +import Anchor from '../Anchor'; +import AnchorContext from '../context'; + +// we use'memo' here in order to only render inner component while context changed. +const CacheInner = memo(() => { + const countRef = useRef(0); + countRef.current++; + // subscribe anchor context + useContext(AnchorContext); + return ( +
+ Child Rendering Count: {countRef.current} +
+ ); +}); + +const CacheOuter = () => { + // We use 'useState' here in order to trigger parent component rendering. + const [count, setCount] = useState(1); + const handleClick = () => { + setCount(count + 1); + }; + // During each rendering phase, the cached context value returned from method 'Anchor#getMemoizedContextValue' will take effect. + // So 'CacheInner' component won't rerender. + return ( +
+ + Parent Rendering Count: {count} + + + +
+ ); +}; + +it("Rendering on Anchor without changed AnchorContext won't trigger rendering on child component.", () => { + const wrapper = mount(); + const childCount = wrapper.find('#child_count').text(); + wrapper.find('#parent_btn').at(0).simulate('click'); + expect(wrapper.find('#parent_count').text()).toBe('2'); + // child component won't rerender + expect(wrapper.find('#child_count').text()).toBe(childCount); + wrapper.find('#parent_btn').at(0).simulate('click'); + expect(wrapper.find('#parent_count').text()).toBe('3'); + // child component won't rerender + expect(wrapper.find('#child_count').text()).toBe(childCount); +}); diff --git a/components/avatar/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/avatar/__tests__/__snapshots__/demo-extend.test.ts.snap index 9b77bfac5d3f..6fb974fcc82f 100644 --- a/components/avatar/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/avatar/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -737,6 +737,142 @@ Array [ +2 +
+
+
+
+ +
+ +
+
+
+ , +