Skip to content

feat(compiler-sfc): enable reactive props destructure by default #7986

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 30, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: remove unused param
  • Loading branch information
yyx990803 committed Mar 30, 2023
commit a0b19338fbd859871e90c891d009b529e7c9adc1
10 changes: 3 additions & 7 deletions packages/compiler-sfc/src/compileScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,11 +412,7 @@ export function compileScript(
}
}

function processDefineProps(
node: Node,
declId?: LVal,
declKind?: VariableDeclaration['kind']
): boolean {
function processDefineProps(node: Node, declId?: LVal): boolean {
if (!isCallOf(node, DEFINE_PROPS)) {
return false
}
Expand Down Expand Up @@ -519,7 +515,7 @@ export function compileScript(
`Props destructure is now reactive by default - ` +
`use destructure with default values instead.`
)
if (processDefineProps(node.arguments[0], declId, declKind)) {
if (processDefineProps(node.arguments[0], declId)) {
if (propsRuntimeDecl) {
error(
`${WITH_DEFAULTS} can only be used with type-based ` +
Expand Down Expand Up @@ -1305,7 +1301,7 @@ export function compileScript(

// defineProps / defineEmits
const isDefineProps =
processDefineProps(init, decl.id, node.kind) ||
processDefineProps(init, decl.id) ||
processWithDefaults(init, decl.id, node.kind)
const isDefineEmits = processDefineEmits(init, decl.id)
if (isDefineProps || isDefineEmits) {
Expand Down