Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Action is invalid after a rerender #84

Open
knownasilya opened this issue Nov 12, 2018 · 2 comments
Open

Action is invalid after a rerender #84

knownasilya opened this issue Nov 12, 2018 · 2 comments

Comments

@knownasilya
Copy link
Contributor

knownasilya commented Nov 12, 2018

screen shot 2018-11-12 at 9 59 01 am

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:

{{some-component obj=obj onSetup=(route-action 'loadShare')}}

the onSetup is fired in didInsertElement and didReceiveAttrs if the component rerendered with a specific object again.

parent:

  actions: {
    loadShare() {
      this.controller.loadShare();
    },
@knownasilya
Copy link
Contributor Author

knownasilya commented Nov 12, 2018

Looks like getRoutes (called from getRouteWithAction) only returns the application and loading routes, so nothing is found.

@knownasilya
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant