inconsistency between reactive and shallowReactive
Version
3.0.0
Reproduction link
https://codepen.io/SeregPie/pen/MWeamRG
Steps to reproduce
let object = {a: {b: 1}};
console.log(isReactive(shallowReactive(object).a)); // false
console.log(isReactive(reactive(object).a)); // false
but
let object = {a: {b: 1}};
console.log(isReactive(reactive(object).a)); // true
console.log(isReactive(shallowReactive(object).a)); // true
let object = {a: ref(1)};
console.log(isRef(reactive(object).a)); // false
console.log(isRef(shallowReactive(object).a)); // false
but
let object = {a: ref(1)};
console.log(isRef(shallowReactive(object).a)); // true
console.log(isRef(reactive(object).a)); // true
What is expected?
The order of the function calls should not matter, because those functions do not alter the original object.
What is actually happening?
Some unexpected things.
Maybe some clear definitions are needed.
Here are my proposals.
// nested object
let object = {a: {b: 1}};
console.log(isReactive(shallowReactive(object).a)); // should always be false
console.log(isReactive(reactive(object).a)); // should always be true
// ref in object
let object = {a: ref(1)};
console.log(isRef(shallowReactive(object).a)); // should always be false
console.log(isRef(reactive(object).a)); // should always be false
// nested ref in object
let object = {a: {b: ref(1)}};
console.log(isRef(shallowReactive(object).a.b)); // should always be true
console.log(isRef(reactive(object).a.b)); // should always be false
// special cases
let object = {a: {b: 1}};
console.log(shallowReactive(reactive(object)) === reactive(object)); // should always be true
console.log(reactive(shallowReactive(object)) === shallowReactive(object)); // ???