Browse Source

fix: Form should not trigger unnescessary onFieldsChange (#43292)

pull/43293/head
二货爱吃白萝卜 1 year ago
committed by GitHub
parent
commit
67ff988b4f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      package.json
  2. 17
      scripts/post-script.js

2
package.json

@ -131,7 +131,7 @@
"rc-dialog": "~9.0.2",
"rc-drawer": "~6.3.0",
"rc-dropdown": "~4.0.0",
"rc-field-form": "~1.30.0",
"rc-field-form": "~1.34.0",
"rc-image": "~5.13.0",
"rc-input": "~0.1.4",
"rc-input-number": "~7.3.9",

17
scripts/post-script.js

@ -18,10 +18,11 @@ const DEPRECIATED_VERSION = {
'https://github.com/ant-design/ant-design/issues/37931',
],
'4.24.0': ['https://github.com/ant-design/ant-design/issues/38371'],
'4.24.11': ['https://github.com/react-component/field-form/pull/593'],
};
function matchDeprecated(version) {
const match = Object.keys(DEPRECIATED_VERSION).find(depreciated =>
const match = Object.keys(DEPRECIATED_VERSION).find((depreciated) =>
semver.satisfies(version, depreciated),
);
@ -38,15 +39,15 @@ const SAFE_DAYS_DIFF = 1000 * 60 * 60 * 24 * 3; // 3 days not update seems to be
(async function process() {
console.log(chalk.cyan('🤖 Post Publish Scripting...\n'));
const { time, 'dist-tags': distTags } = await fetch('http://registry.npmjs.org/antd').then(res =>
res.json(),
const { time, 'dist-tags': distTags } = await fetch('http://registry.npmjs.org/antd').then(
(res) => res.json(),
);
console.log('🐚 Latest Conch Version:', chalk.green(distTags.conch || 'null'), '\n');
// Sort and get the latest versions
const versionList = Object.keys(time)
.filter(version => semver.valid(version) && !semver.prerelease(version))
.filter((version) => semver.valid(version) && !semver.prerelease(version))
.sort((v1, v2) => {
const time1 = moment(time[v1]).valueOf();
const time2 = moment(time[v2]).valueOf();
@ -59,7 +60,7 @@ const SAFE_DAYS_DIFF = 1000 * 60 * 60 * 24 * 3; // 3 days not update seems to be
// Cut off
.slice(0, 30)
// Formatter
.map(version => ({
.map((version) => ({
publishTime: time[version],
timeDiff: moment().diff(moment(time[version])),
value: version,
@ -107,7 +108,7 @@ const SAFE_DAYS_DIFF = 1000 * 60 * 60 * 24 * 3; // 3 days not update seems to be
name: 'conchVersion',
default: defaultVersion,
message: 'Please select Conch Version:',
choices: latestVersions.map(info => {
choices: latestVersions.map((info) => {
const { value, publishTime, depreciated } = info;
const desc = moment(publishTime).fromNow();
@ -127,7 +128,7 @@ const SAFE_DAYS_DIFF = 1000 * 60 * 60 * 24 * 3; // 3 days not update seems to be
// Current Mark
value === distTags.conch ? chalk.gray('- current') : '',
]
.filter(str => String(str).trim())
.filter((str) => String(str).trim())
.join(' '),
};
}),
@ -139,7 +140,7 @@ const SAFE_DAYS_DIFF = 1000 * 60 * 60 * 24 * 3; // 3 days not update seems to be
if (deprecatedObj.match) {
console.log('\n');
console.log(chalk.red('Deprecated For:'));
deprecatedObj.reason.forEach(reason => {
deprecatedObj.reason.forEach((reason) => {
console.log(chalk.yellow(` * ${reason}`));
});
console.log('\n');

Loading…
Cancel
Save