Uncaught TypeError: Cannot read property 'sub' of undefined #169

Closed
toddb opened this Issue Nov 5, 2012 · 6 comments

Comments

Projects
None yet
2 participants
@toddb

toddb commented Nov 5, 2012

Runtime error (Chrome and Mozilla)

Uncaught TypeError: Cannot read property 'sub' of undefined jsviews-1.0pre.js:31
(anonymous function) jsviews-1.0pre.js:31
(anonymous function) jsviews-1.0pre.js:1239

Found in v1.0pre pre beta commit counter: 21
Severity: Low

I use requirejs for managing dependencies and loading.

Here is my boostrap:

require(
[
    'requirejs',
    'order',
    'jquery',
    'jsrender',
    'jsobservable',
    'jsviews'
] );

Of course, if was a loading order issue:

require(
[
    'requirejs',
    'order',
    'order!jquery',
    'order!jsrender',
    'order!jsobservable',
    'order!jsviews'
]);

However, you have guards earlier in the code (lines 16-21):

if (!$) {
    // jQuery is not loaded.
    throw "requires jQuery"; // for Beta (at least) we require jQuery
}

if ($.link) return; // JsViews is already loaded

Is it worth a guard for runtime load order problems?

@BorisMoore

This comment has been minimized.

Show comment
Hide comment
@BorisMoore

BorisMoore Nov 5, 2012

Owner

Yes, fair enough. Adding this to upcoming bits:

if (!$.views) {
    // JsRender is not loaded.
    throw "requires JsRender"; // JsRender must be loaded before JsViews
}
Owner

BorisMoore commented Nov 5, 2012

Yes, fair enough. Adding this to upcoming bits:

if (!$.views) {
    // JsRender is not loaded.
    throw "requires JsRender"; // JsRender must be loaded before JsViews
}
@toddb

This comment has been minimized.

Show comment
Hide comment
@toddb

toddb Nov 5, 2012

Cheers. It is such a small thing!

toddb commented Nov 5, 2012

Cheers. It is such a small thing!

@toddb toddb closed this Nov 5, 2012

@toddb toddb reopened this Nov 5, 2012

@BorisMoore

This comment has been minimized.

Show comment
Hide comment
@BorisMoore

BorisMoore Nov 5, 2012

Owner

Small, but hey :)

Owner

BorisMoore commented Nov 5, 2012

Small, but hey :)

@BorisMoore

This comment has been minimized.

Show comment
Hide comment
@BorisMoore

BorisMoore Dec 2, 2012

Owner

This is a JsViews bug, not a JsRender bug, Fix coming in JsViews update 22.

Owner

BorisMoore commented Dec 2, 2012

This is a JsViews bug, not a JsRender bug, Fix coming in JsViews update 22.

@toddb

This comment has been minimized.

Show comment
Hide comment
@toddb

toddb Dec 3, 2012

Nice. Thanks

toddb commented Dec 3, 2012

Nice. Thanks

BorisMoore added a commit that referenced this issue Dec 3, 2012

Commit counter 22. Major update, including some BREAKING CHANGES, and…
… many

new features. More samples and documentation for new features will be added
incrementally in coming updates.

Among the changes:

Detailed APIs modified for consistent arguments and use of this
pointer, and for maximum extensibility. See updated samples for usage...

Compiled templates restructured for easier debugging.

View object restructured for clarity.

View now has a type property, e.g. type="item"
Only "item" views have index properties, but to get the index from a nested
view use view.get("item").index.

nodes collection on a view is now a function, view.nodes().

Settings grouped onto a $.views.settings object.
View navigation features improved, with view.get(...) and $.view(elem, ...)
tagCtx object provides improved access to the args and properties of a tag
 invocation.

Adding resources (helpers, converters, tags, etc) to a template now supported
by passing parent template to API. e.g. $.tags({...}, parentTemplate).
Many improvements to custom tags, - used also as part of JsViews integration
for new JsViews Tag Controls. (Instantiation of tags as control instances).

Template inclusion now supported with simpler syntax {{for tmpl=.../))

Fixes for issues #169, #162, #157, #156, #155, #153, #145
@BorisMoore

This comment has been minimized.

Show comment
Hide comment
@BorisMoore

BorisMoore Dec 3, 2012

Owner

Done, in update 22.

Owner

BorisMoore commented Dec 3, 2012

Done, in update 22.

@BorisMoore BorisMoore closed this Dec 3, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment