Closed ianterrell closed 1 year ago
Hi, as mentioned in #490, invoking that callback after initializing the controller and before the controller is connected is the expected behavior. Maybe you could stop the method execution if the element is not connected with something like:
if (!this.element.isConnected) return
Thank you, I misread and misinterpreted the commentary on #490. I had been erroneously conceptualizing connect()
as a constructor and conflated it with initialization.
I have a situation where I want polymorphic outlets, and I've solved it by having "bridging" controllers so that I can reference a homogeneous collection of outlets, where each member of that collection can reference another specific controller. I do it by setting a
controller
value on the bridging controller from the non-homogenous bridged controller.In some circumstances I notice that the
controllerValueChanged
callback occurs before the bridging controller'sconnect
is executed.Bridging controller:
Bridged controller base class:
Observed order of operations:
For context, ultimately I do something like this in the
controllerValueChanged
:But it's now growing more complex managing the synchronization of everything. I think my approach can use some work generally, and I'd love to see #628 or other approach fleshed out, but I think this may be a bug regardless.