Action is invalid after a rerender
knownasilya opened this issue · 2 comments
knownasilya commented
backburner.js:832 Uncaught TypeError: method is not a function
at Backburner._join (backburner.js:832)
at Backburner.join (backburner.js:612)
at Function.join (index.js:164)
at routeAction (route-action.js:55)
at Class.didReceiveAttrs (component.js:118)
at Class.trigger (core_view.js:62)
at Class.superWrapper [as trigger] (ember-utils.js:308)
at CurlyComponentManager.update (ember-glimmer.js:3814)
at UpdateComponentOpcode.evaluate (runtime.js:1537)
at UpdatingVM.execute (runtime.js:3644)
Both the action and handler end up being undefined for some reason. This action fires fine in some situations, but when it's called on didReceiveAttrs
in other situations it seems to do this.
The action is assigned in the index
route, but defined in the parent route.
index:
the onSetup
is fired in didInsertElement
and didReceiveAttrs
if the component rerendered with a specific object again.
parent:
actions: {
loadShare() {
this.controller.loadShare();
},
knownasilya commented
Looks like getRoutes
(called from getRouteWithAction
) only returns the application and loading routes, so nothing is found.
knownasilya commented
Wrapping my action call in an event from google maps helped:
google.maps.event.addListenerOnce(map, 'tilesloaded', bind(this, () => {
if (this.isDestroyed || this.isDestroying) {
return;
}
onSetup();
}));
afterRender
and next
didn't work.