Closed ashleysommer closed 7 years ago
Thanks for this report! Nice find. Will release new versions with this fix.
If I may ask, how did you find this bug? ember-leaflet was still using ember-composibility-tools 0.0.1.
Great question.
I was writing an update for the ember-leaflet-layer-control package to get it work with ember-leaflet v3.0.2. The transition to using ember-composibility-tools in ember-leaflet v3.0.2 broke the current version of ember-leaflet-layer-controls, it had to be updated to use ember-composibility-tools in its components.
I added ember-composibility-tools to the dependencies, and it automatically brought in v0.0.2. I didn't realise it was different to the version ember-leaflet was using. After that, npm decided to use v0.0.2 for ember-leaflet too, and my test application stopped working. That's when I started stepping through with a debugger to find the problem.
This commit: https://github.com/miguelcobain/ember-composability-tools/commit/b3a7d7f0b293b2d535ca4d6761b0a1eb38582066 adds fallbacks to the
K()
function fordidInsertParent()
andwillDestroyParent()
for theparent
mixin.It seems that unfortunately these fallbacks actually override the
didInsertParent()
andwillDestroyParent()
functions inherited in an extended class.For example, in ember leaflet, the
leaflet-map
component is defined as:As it is a top-level parent component, it's creation is triggered in the
didInsertElement()
function in theparent
mixin, which in turn callsdidInsertParent()
on itself. Asleaflet-map
does not have adidInsertParent()
function defined, it should use the function provided byBaseLayer
, (which callscreateLayer()
anddidCreateLayer()
etc, as it should), but instead it now calls the new fallbackdidInsertElement()
function defined to beK()
in theparent
mixin. This breaks theleaflet-map
component, because it never getscreateLayer()
called, thus it never gets a_layer
property assigned to itself.