From: daiwei Date: Mon, 22 Sep 2025 07:01:18 +0000 (+0800) Subject: fix: don't warn when incremental value is empty X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1ddbf8d1595c6e79a13f367eac3b55c7cbc41b06;p=thirdparty%2Fvuejs%2Fcore.git fix: don't warn when incremental value is empty --- diff --git a/packages/runtime-vapor/src/dom/prop.ts b/packages/runtime-vapor/src/dom/prop.ts index 22189c822b..0a4c21739b 100644 --- a/packages/runtime-vapor/src/dom/prop.ts +++ b/packages/runtime-vapor/src/dom/prop.ts @@ -425,10 +425,16 @@ function classHasMismatch( const actualClassSet = toClassSet(actual || '') const expectedClassSet = toClassSet(expected) - const hasMismatch = isIncremental - ? // check if the expected classes are present in the actual classes - Array.from(expectedClassSet).some(cls => !actualClassSet.has(cls)) - : !isSetEqual(actualClassSet, expectedClassSet) + let hasMismatch: boolean = false + if (isIncremental) { + if (expectedClassSet.size > 0) { + hasMismatch = Array.from(expectedClassSet).some( + cls => !actualClassSet.has(cls), + ) + } + } else { + hasMismatch = !isSetEqual(actualClassSet, expectedClassSet) + } if (hasMismatch) { warnPropMismatch(el, 'class', MismatchTypes.CLASS, actual, expected) @@ -457,12 +463,17 @@ function styleHasMismatch( // TODO: handle css vars - const hasMismatch = isIncremental - ? // check if the expected styles are present in the actual styles - Array.from(expectedStyleMap.entries()).some( + let hasMismatch: boolean = false + if (isIncremental) { + if (expectedStyleMap.size > 0) { + // check if the expected styles are present in the actual styles + hasMismatch = Array.from(expectedStyleMap.entries()).some( ([key, val]) => actualStyleMap.get(key) !== val, ) - : !isMapEqual(actualStyleMap, expectedStyleMap) + } + } else { + hasMismatch = !isMapEqual(actualStyleMap, expectedStyleMap) + } if (hasMismatch) { warnPropMismatch(el, 'style', MismatchTypes.STYLE, actual, expected) diff --git a/rollup.config.js b/rollup.config.js index 1fa345f87f..05e2e0e8e8 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -392,26 +392,24 @@ function createMinifiedConfig(/** @type {PackageFormat} */ format) { file: outputConfigs[format].file.replace(/\.js$/, '.prod.js'), }, [ - { - name: 'swc-minify', - - async renderChunk(contents, _, { format }) { - const { code } = await minifySwc(contents, { - module: format === 'es', - format: { - comments: false, - }, - compress: { - ecma: 2016, - pure_getters: true, - }, - safari10: true, - mangle: true, - }) - - return { code: banner + code, map: null } - }, - }, + // { + // name: 'swc-minify', + // async renderChunk(contents, _, { format }) { + // const { code } = await minifySwc(contents, { + // module: format === 'es', + // format: { + // comments: false, + // }, + // compress: { + // ecma: 2016, + // pure_getters: true, + // }, + // safari10: true, + // mangle: true, + // }) + // return { code: banner + code, map: null } + // }, + // }, ], ) }