Skip to content

Commit

Permalink
Merge branch 'main' into feat-computed-side-effect-warn
Browse files Browse the repository at this point in the history
  • Loading branch information
Doctor-wu committed Feb 13, 2024
2 parents 43e2ea8 + b99ac93 commit bc74137
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 57 deletions.
4 changes: 4 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,9 @@

// ESM only
'estree-walker',

// pinned
// https://github.com/vuejs/core/issues/10300#issuecomment-1940855364
'lru-cache'
],
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"markdown-table": "^3.0.3",
"marked": "^11.2.0",
"minimist": "^1.2.8",
"npm-run-all2": "^5.0.2",
"npm-run-all2": "^6.1.2",
"picocolors": "^1.0.0",
"prettier": "^3.2.2",
"pretty-bytes": "^6.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-sfc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@babel/types": "^7.23.9",
"@vue/consolidate": "^0.17.3",
"hash-sum": "^2.0.0",
"lru-cache": "^10.2.0",
"lru-cache": "10.1.0",
"merge-source-map": "^1.1.0",
"minimatch": "^9.0.3",
"postcss-modules": "^6.0.0",
Expand Down
19 changes: 17 additions & 2 deletions packages/runtime-core/src/componentProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -597,8 +597,23 @@ function validatePropName(key: string) {
// use function string name to check type constructors
// so that it works across vms / iframes.
function getType(ctor: Prop<any>): string {
const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/)
return match ? match[2] : ctor === null ? 'null' : ''
// Early return for null to avoid unnecessary computations
if (ctor === null) {
return 'null'
}

// Avoid using regex for common cases by checking the type directly
if (typeof ctor === 'function') {
// Using name property to avoid converting function to string
return ctor.name || ''
} else if (typeof ctor === 'object') {
// Attempting to directly access constructor name if possible
const name = ctor.constructor && ctor.constructor.name
return name || ''
}

// Fallback for other types (though they're less likely to have meaningful names here)
return ''
}

function isSameType(a: Prop<any>, b: Prop<any>): boolean {
Expand Down
4 changes: 1 addition & 3 deletions packages/runtime-core/src/errorHandling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,11 @@ export function callWithErrorHandling(
type: ErrorTypes,
args?: unknown[],
) {
let res
try {
res = args ? fn(...args) : fn()
return args ? fn(...args) : fn()
} catch (err) {
handleError(err, instance, type)
}
return res
}

export function callWithAsyncErrorHandling(
Expand Down
6 changes: 5 additions & 1 deletion packages/runtime-dom/src/directives/vShow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ export const vShow: ObjectDirective<VShowElement> & { name?: 'show' } = {
}
},
updated(el, { value, oldValue }, { transition }) {
if (!value === !oldValue && el.style.display === el[vShowOldKey]) return
if (
!value === !oldValue &&
(el.style.display === el[vShowOldKey] || !value)
)
return
if (transition) {
if (value) {
transition.beforeEnter(el)
Expand Down
70 changes: 22 additions & 48 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion scripts/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ async function main() {
if (!skipTests) {
step('\nRunning tests...')
if (!isDryRun) {
await run('pnpm', ['run', 'test'])
await run('pnpm', ['run', 'test', '--run'])
} else {
console.log(`Skipped (dry run)`)
}
Expand Down

0 comments on commit bc74137

Please sign in to comment.