Subscribe on changes!

Problem with Proxy and binding context

avatar
Apr 11th 2021

Version

3.0.11

Reproduction link

https://jsfiddle.net/npjw7dLf/13/

Steps to reproduce

  1. bind context for method in a class constructor
  2. Create a class instance from Vue.reactive
  3. call method

What is expected?

Method call with the Proxy context as in Vue.reactive

What is actually happening?

Method call with the original context

avatar
Apr 12th 2021

According to the reproduction you gave, this is expected behavior. When Module's constructor is executed, everything is not reactive, so you bind the original instance of ModuleChild as the context object instead of the reactive version of ModuleChild's instance. This is why the execution of setNewItemMediatorProblem will not trigger the update.

So you need to wrap it as reactive when creating a ModuleChild instance, see https://jsfiddle.net/HcySunYang/a13u2ebo/1/