-
-
Notifications
You must be signed in to change notification settings - Fork 9k
Description
What problem does this feature solve?
In addition to reactive, readonly and shallowReadonly, add the missing shallow method and export it.
If one desires to a have reactive object, whose contents are not reactive (as an optimization or for explicitness), one has to call markNonReactive on every value set on a reactive object.
This is ok when initializing the object, but becomes a lot of effort when it has to be put at any place where a property is set to a new value.
The code to implement shallow already exists, as createGetter and createSetter accept two arguments isReadonly and shallow (consistency: why not isShallow?). In fact it's the only combination of flags out of the four possible that is missing.
What does the proposed API look like?
shallow method, makes a reactive object like reactive, readonly and shallowReadonly but doesn't make values returned by get reactive.