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

Can't patch Backbone model Of typescript app #227

Open
jklmli opened this issue Jan 30, 2015 · 11 comments
Open

Can't patch Backbone model Of typescript app #227

jklmli opened this issue Jan 30, 2015 · 11 comments
Labels

Comments

@jklmli
Copy link
Contributor

jklmli commented Jan 30, 2015

Getting this error when attempting to open up Marionette Inspector:

screen shot 2015-01-30 at 2 11 29 pm

The model in question:

class State extends Backbone.Model implements AbstractAnalyzeQueryView.State {
  get query(): ListQuery { return this.get('query'); }
  set query(z: ListQuery) { this.set('query', z); }

  constructor(query: ListQuery = new ListQuery(BuiltInSegment.USER)) {
    super({
      query: query
    });
  }
}

When I log this inside the get query(), I get this.

screen shot 2015-01-30 at 2 17 22 pm

This looks to be an issue with getters and setters. Does Marionette Inspector support these? Is it due to the way Typescript is compiling these?

@jasonLaster
Copy link
Member

Honestly I'm not sure if the inspector supports typescript. There's an es6 fix on minor for example. Happy to pair tomorrow or next week and figure it out. Come to our gitter room, link is on the readme.

@jasonLaster jasonLaster changed the title Can't patch Backbone model Can't patch Backbone model Of typescript app Jan 31, 2015
@gwynjudd
Copy link

gwynjudd commented Apr 1, 2015

How can I tell if this fix has made it into the extension I'm using? I have version 0.5.4 if that helps. I am hitting something that looks like a similar issue, but I don't really know how to tell.

@jasonLaster
Copy link
Member

hey @gwynjudd mind running it locally and letting me know what you see https://github.com/marionettejs/marionette.inspector/blob/master/docs/developing_locally.md

@gwynjudd
Copy link

gwynjudd commented Apr 1, 2015

I get the same issue as I was seeing before (this is in backbone.marionette.js):

_getModule: function(parentModule, moduleName, app, def, args) {
  var options = _.extend({}, def);
  var ModuleClass = this.getClass(def);

  // Get an existing module of this name if we have one
  var module = parentModule[moduleName];

  if (!module) {
    // Create a new module if we don't have one
    module = new ModuleClass(moduleName, app, options);
    parentModule[moduleName] = module;
    // store the module on the parent
    parentModule.submodules[moduleName] = module; <---- ***
  }

  return module;
},

On the line I marked above, parentModule.submodules is undefined. parentModule is the prototype of my application class instance. The call stack shows that the extension is calling a property defined on my application class, but this is the prototype, not the actual instance:

        get sidebar(): Sidebar.SidebarController {
            return this.module("core.sidebar", null).sidebar;
        }

In the stack before this is a lot of function calls from the extension itself. Here is the top of the stack:

image

@gwynjudd
Copy link

gwynjudd commented Apr 1, 2015

After I let the debugger continue, the site loads ok. The Marionette tab in the developer tools shows this:

image

And then after a while this:

image

It never gets past the "Loading viewxx" stage when I select a view

@jasonLaster
Copy link
Member

Application is important because that's how the views are found.

Try checking __agent to see if the views are saved.
I forgot the key that keeps all the components but there's a registry.

Thanks for the details , we'll get to the bottom of tyis

@gwynjudd
Copy link

gwynjudd commented Apr 7, 2015

@jasonLaster - what do I look at in __agent to see the views? Here is the top bit of __agent in the developer tools:

image

@jasonLaster
Copy link
Member

Hi, sorry this was made private recently

__agent.getAppComponentsInfo('View')

@gwynjudd
Copy link

gwynjudd commented Apr 9, 2015

There appears to be nothing in there

image

@jasonLaster
Copy link
Member

Hmm try looking at the region tree.

__agent.appObserver.regionTree()

I think.

@gwynjudd
Copy link

gwynjudd commented Apr 9, 2015

This appears to have the appropriate values:

image

It matches up with the structure of the main application region that we have

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

No branches or pull requests

4 participants