A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/vuejs/vue-next/commit/5566d39d467ebdd4e4234bc97d62600ff01ea28e below:

only trigger $attrs update when it has actually changed · vuejs/core@5566d39 · GitHub

@@ -188,6 +188,7 @@ export function updateProps(

188 188

} = instance

189 189

const rawCurrentProps = toRaw(props)

190 190

const [options] = instance.propsOptions

191 +

let hasAttrsChanged = false

191 192 192 193

if (

193 194

// always force full diff in dev

@@ -213,7 +214,10 @@ export function updateProps(

213 214

// attr / props separation was done on init and will be consistent

214 215

// in this code path, so just check if attrs have it.

215 216

if (hasOwn(attrs, key)) {

216 -

attrs[key] = value

217 +

if (value !== attrs[key]) {

218 +

attrs[key] = value

219 +

hasAttrsChanged = true

220 +

}

217 221

} else {

218 222

const camelizedKey = camelize(key)

219 223

props[camelizedKey] = resolvePropValue(

@@ -232,13 +236,18 @@ export function updateProps(

232 236

) {

233 237

continue

234 238

}

235 -

attrs[key] = value

239 +

if (value !== attrs[key]) {

240 +

attrs[key] = value

241 +

hasAttrsChanged = true

242 +

}

236 243

}

237 244

}

238 245

}

239 246

} else {

240 247

// full props update.

241 -

setFullProps(instance, rawProps, props, attrs)

248 +

if (setFullProps(instance, rawProps, props, attrs)) {

249 +

hasAttrsChanged = true

250 +

}

242 251

// in case of dynamic props, check if we need to delete keys from

243 252

// the props object

244 253

let kebabKey: string

@@ -278,13 +287,16 @@ export function updateProps(

278 287

for (const key in attrs) {

279 288

if (!rawProps || !hasOwn(rawProps, key)) {

280 289

delete attrs[key]

290 +

hasAttrsChanged = true

281 291

}

282 292

}

283 293

}

284 294

}

285 295 286 296

// trigger updates for $attrs in case it's used in component slots

287 -

trigger(instance, TriggerOpTypes.SET, '$attrs')

297 +

if (hasAttrsChanged) {

298 +

trigger(instance, TriggerOpTypes.SET, '$attrs')

299 +

}

288 300 289 301

if (__DEV__) {

290 302

validateProps(rawProps || {}, props, instance)

@@ -298,6 +310,7 @@ function setFullProps(

298 310

attrs: Data

299 311

) {

300 312

const [options, needCastKeys] = instance.propsOptions

313 +

let hasAttrsChanged = false

301 314

if (rawProps) {

302 315

for (const key in rawProps) {

303 316

// key, ref are reserved and never passed down

@@ -335,7 +348,10 @@ function setFullProps(

335 348

) {

336 349

continue

337 350

}

338 -

attrs[key] = value

351 +

if (value !== attrs[key]) {

352 +

attrs[key] = value

353 +

hasAttrsChanged = true

354 +

}

339 355

}

340 356

}

341 357

}

@@ -353,6 +369,8 @@ function setFullProps(

353 369

)

354 370

}

355 371

}

372 + 373 +

return hasAttrsChanged

356 374

}

357 375 358 376

function resolvePropValue(


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4