Subscribe on changes!

The comparison of empty objects seems to be wrong

avatar
Jan 14th 2021

Version

3.0.5

Reproduction link

componentPublicInstance.ts#L286-L301

What is expected?

var props = {}
const EMPTY_OBJ: { readonly [key: string]: any } = __DEV__
  ? Object.freeze({})
  : {} // actually EMPTY_OBJ = Object.freeze({}) or EMPTY_OBJ={}

console.log(props===EMPTY_OBJ) // Always false
console.log(props!==EMPTY_OBJ) // Always true

console.log({}==={}) // Always false

What is actually happening?

I'm not quite sure if what I said was wrong~~

avatar
Jan 14th 2021

If you have found a bug please provide a reproduction, if you have a code improvement proposal, please open a pull request

avatar
Jan 14th 2021

If you have found a bug please provide a reproduction, if you have a code improvement proposal, please open a pull request

Hi, @posva: Sorry about that.

Can you help a little to explain the above phenomenon? I'm not quite sure if the error I'm pointing out is correct.

If what I say is correct, I will initiate a PR in the follow-up to suggest improvements.

avatar
Jan 14th 2021

just like that:

var a = {}
var b = a
a===b // true

I got. But I still think something is not quite right. 😄