iron-meteor / iron-layout Goto Github PK
View Code? Open in Web Editor NEWDynamic layout with support for rendering dynamic templates into regions.
License: MIT License
Dynamic layout with support for rendering dynamic templates into regions.
License: MIT License
I see this a lot now after upgrading to devel iron-router:
Layout.prototype.beginRendering = function () {
if (this._renderedRegions)
throw new Error("You called beginRendering again before calling endRendering");
this._renderedRegions = {};
};
I error there, on the error thrown.
My observations of the state of the app when this error is thrown:
I will hit the error, and one of the regions in the layout will be rendered, but a different one will not. For example, I'll have this layout:
<template name="layout">
{{> yield region='navbar'}}
<div id="container-main" class="container layout-1up">
{{> yield region='sidebar'}}
<div id="inner-main">
{{> yield}}
</div>
</div>
</template>
and the main yield will have rendered, the navbar will have not rendered, and I throw the error.
I'm in a route with a reactive action. This may be a red herring.
...
action: function () {
// Something reactive:
if (Meteor.user()) {
// Dies here:
this.redirect('some path');
} else {
this.render();
}
}
...
});
I've hit a problem when using iron:router in a package with Tinytest. The issue has already been raised (next door) iron-meteor/iron-router#1349. It can easily be replicated as follows:
$ meteor create dummy
$ cd dummy
$ meteor create --package paq
Then add iron router into the package.js file
Package.onUse(function(api) {
api.versionsFrom('1.1.0.2');
api.use('iron:router');
api.addFiles('paq.js');
});
Running the tests gives the following in the browser console
Uncaught TypeError: Template.__create__ is not a function
Uncaught TypeError: undefined is not a function
Uncaught TypeError: Cannot read property 'RouteController' of undefined
Exception in defer callback: TypeError: Cannot read property 'insert' of undefined
at Utils.extend.autoRender (http://localhost:3000/packages/iron_router.js?21e016398976d1792ea62f1079e9141f6b298416:1627:17)
at http://localhost:3000/packages/iron_router.js?21e016398976d1792ea62f1079e9141f6b298416:1456:16
at _.extend.withValue (http://localhost:3000/packages/meteor.js?43b7958c1598803e94014f27f5f622b0bddc0aaf:955:17)
at withoutInvocation (http://localhost:3000/packages/meteor.js?43b7958c1598803e94014f27f5f622b0bddc0aaf:435:45)
at Object.Meteor.bindEnvironment (http://localhost:3000/packages/meteor.js?43b7958c1598803e94014f27f5f622b0bddc0aaf:983:22)
at onGlobalMessage (http://localhost:3000/packages/meteor.js?43b7958c1598803e94014f27f5f622b0bddc0aaf:372:23)
I have tried mocking it with mocks.js
Template = function() { /* do nothing */ }
and package.js
Package.onTest(function(api) {
api.use('tinytest');
api.addFiles('mocks.js');
api.use('paq');
api.addFiles('paq-tests.js');
});
but I still get the error.
Blaze-Layout is being called in the smart.json, thus being installed.
Inside Layout.prototype._createDynamicTemplate function (line 190-199), It sets to run hook 'onRenderRegion' ,when the dynamic template's onRender hook. onRender function is undefined.
I couldn't find the onRender function inside the dynamic_template.js from iron-dynamic-template package. I also grep meteor core packages (as of 0.8.2) with no luck.
@cmather Could you give me any pointer on where I can find onRender?
Hi...
I have just recently migrated my meteor project (under development) to meteor 0.9.0.1 and followed all instructions for the migration of packages. However, whenever i open a template, this error keeps popping up although I have already added the Iron-Layout package via meteor add iron:layout. I am not sure if this is an iron-layout issue or caused by other packages which are dependent on iron-layout.
The complete error are as follows:
info: [famous-views] Current logging default is "debug". Change in your app with Logger.setLevel("famous-views", "info"); console.coffee:18
warn: [famous-views] Creating a new main context. If you already have your own, set FView.mainCtx = yourMainContext (or to false to get rid of this warning) console.coffee:18
debug: [famous-views] New SequentialLayout (#1), content from "appLayout" (parent: Template.famousInit) console.coffee:18
debug: [famous-views] New HeaderFooterLayout (#2), content from inline block (parent: Template.appLayout) console.coffee:18
debug: [famous-views] New Surface (#3), content from "yieldHeader" (parent: Famous.HeaderFooterLayout, template: Template.appLayout) console.coffee:18
Uncaught Error: No Iron.Layout found so you can't use yield! layout.js:290
debug: [famous-views] New HeaderFooterLayout (#4), content from inline block (parent: Template.appLayout) console.coffee:18
debug: [famous-views] New Surface (#5), content from "yieldHeader" (parent: Famous.HeaderFooterLayout, template: Template.appLayout) console.coffee:18
debug: [famous-views] New View (#6), content from "yieldMain" (parent: Famous.HeaderFooterLayout, template: Template.appLayout) console.coffee:18
debug: [famous-views] New RenderController (#7), content from inline block (parent: Template.mainPanel) console.coffee:18
debug: [famous-views] New Surface (#8), content from inline block (parent: if, template: Template.home) console.coffee:18
debug: [famous-views] New Surface (#9), content from "yieldFooter" (parent: Famous.HeaderFooterLayout, template: Template.appLayout) console.coffee:18
where the Uncaught Error are as follows:
Uncaught Error: No Iron.Layout found so you can't use yield! layout.js:290
(anonymous function) layout.js:290
doRender view.js:194
(anonymous function) view.js:142
Blaze.withCurrentView view.js:375
viewAutorun view.js:141
Deps.Computation._compute deps.js:196
Deps.Computation deps.js:130
Deps.autorun deps.js:344
Blaze.View.autorun view.js:140
(anonymous function) view.js:188
Deps.nonreactive deps.js:364
Blaze.materializeView view.js:187
Blaze.DOMMaterializer.def.visitObject materializer.js:116
HTML.Visitor.def.visit visitors.js:61
doMaterialize view.js:199Deps.nonreactive deps.js:364doRender view.js:197(anonymous function) view.js:142Blaze.withCurrentView view.js:375viewAutorun view.js:141Deps.Computation._compute deps.js:196Deps.Computation deps.js:130Deps.autorun deps.js:344Blaze.View.autorun view.js:140(anonymous function) view.js:188Deps.nonreactive deps.js:364Blaze.materializeView view.js:187Blaze.DOMMaterializer.def.visitObject materializer.js:116HTML.Visitor.def.visit visitors.js:61Blaze.DOMMaterializer.def.visitArray materializer.js:21HTML.Visitor.def.visit visitors.js:59Blaze.DOMMaterializer.def.visitTag materializer.js:99HTML.Visitor.def.visit visitors.js:46doMaterialize view.js:199Deps.nonreactive deps.js:364doRender view.js:197(anonymous function) view.js:142Blaze.withCurrentView view.js:375viewAutorun view.js:141Deps.Computation._compute deps.js:196Deps.Computation deps.js:130Deps.autorun deps.js:344Blaze.View.autorun view.js:140(anonymous function) view.js:188Deps.nonreactive deps.js:364Blaze.materializeView view.js:187Blaze.DOMMaterializer.def.visitObject materializer.js:116HTML.Visitor.def.visit visitors.js:61doMaterialize view.js:199Deps.nonreactive deps.js:364doRender view.js:197(anonymous function) view.js:142Blaze.withCurrentView view.js:375viewAutorun view.js:141Deps.Computation._compute deps.js:196Deps.Computation deps.js:130Deps.autorun deps.js:344Blaze.View.autorun view.js:140(anonymous function) view.js:188Deps.nonreactive deps.js:364Blaze.materializeView view.js:187famousCreated famous.js:254(anonymous function) templating.js:127fireCallbacks view.js:155Deps.nonreactive deps.js:364(anonymous function) view.js:152Blaze.withCurrentView view.js:375Blaze._fireCallbacks view.js:151Blaze.materializeView view.js:167Blaze.DOMMaterializer.def.visitObject materializer.js:116HTML.Visitor.def.visit visitors.js:61doMaterialize view.js:199Deps.nonreactive deps.js:364doRender view.js:197(anonymous function) view.js:142Blaze.withCurrentView view.js:375viewAutorun view.js:141Deps.Computation._compute deps.js:196Deps.Computation deps.js:130Deps.autorun deps.js:344Blaze.View.autorun view.js:140(anonymous function) view.js:188Deps.nonreactive deps.js:364Blaze.materializeView view.js:187Blaze.DOMMaterializer.def.visitObject materializer.js:116HTML.Visitor.def.visit visitors.js:61Blaze.DOMMaterializer.def.visitArray materializer.js:21HTML.Visitor.def.visit visitors.js:59doMaterialize view.js:199Deps.nonreactive deps.js:364doRender view.js:197(anonymous function) view.js:142Blaze.withCurrentView view.js:375viewAutorun view.js:141Deps.Computation._compute deps.js:196Deps.Computation deps.js:130Deps.autorun deps.js:344Blaze.View.autorun view.js:140(anonymous function) view.js:188Deps.nonreactive deps.js:364Blaze.materializeView view.js:187Blaze.DOMMaterializer.def.visitObject materializer.js:116HTML.Visitor.def.visit visitors.js:61doMaterialize view.js:199Deps.nonreactive deps.js:364doRender view.js:197(anonymous function) view.js:142Blaze.withCurrentView view.js:375viewAutorun view.js:141Deps.Computation._compute deps.js:196Deps.Computation deps.js:130Deps.autorun deps.js:344Blaze.View.autorun view.js:140(anonymous function) view.js:188Deps.nonreactive deps.js:364Blaze.materializeView view.js:187famousCreated famous.js:254(anonymous function) templating.js:127fireCallbacks view.js:155Deps.nonreactive deps.js:364(anonymous function) view.js:152Blaze.withCurrentView view.js:375Blaze._fireCallbacks view.js:151Blaze.materializeView view.js:167Blaze.DOMMaterializer.def.visitObject materializer.js:116HTML.Visitor.def.visit visitors.js:61doMaterialize view.js:199Deps.nonreactive deps.js:364doRender view.js:197(anonymous function) view.js:142Blaze.withCurrentView view.js:375viewAutorun view.js:141Deps.Computation._compute deps.js:196Deps.Computation deps.js:130Deps.autorun deps.js:344Blaze.View.autorun view.js:140(anonymous function) view.js:188Deps.nonreactive deps.js:364Blaze.materializeView view.js:187Blaze.DOMMaterializer.def.visitObject materializer.js:116HTML.Visitor.def.visit visitors.js:61Blaze.DOMMaterializer.def.visitArray materializer.js:21HTML.Visitor.def.visit visitors.js:59doMaterialize view.js:199Deps.nonreactive deps.js:364doRender view.js:197(anonymous function) view.js:142Blaze.withCurrentView view.js:375viewAutorun view.js:141Deps.Computation._compute deps.js:196Deps.Computation deps.js:130Deps.autorun deps.js:344Blaze.View.autorun view.js:140(anonymous function) view.js:188Deps.nonreactive deps.js:364Blaze.materializeView view.js:187Blaze.DOMMaterializer.def.visitObject materializer.js:116HTML.Visitor.def.visit visitors.js:61doMaterialize view.js:199Deps.nonreactive deps.js:364doRender view.js:197(anonymous function) view.js:142Blaze.withCurrentView view.js:375viewAutorun view.js:141Deps.Computation._compute deps.js:196Deps.Computation deps.js:130Deps.autorun deps.js:344Blaze.View.autorun view.js:140(anonymous function) view.js:188Deps.nonreactive deps.js:364Blaze.materializeView view.js:187famousCreated famous.js:254(anonymous function) templating.js:127fireCallbacks view.js:155Deps.nonreactive deps.js:364(anonymous function) view.js:152Blaze.withCurrentView view.js:375Blaze._fireCallbacks view.js:151Blaze.materializeView view.js:167Blaze.DOMMaterializer.def.visitObject materializer.js:116HTML.Visitor.def.visit visitors.js:61doMaterialize view.js:199Deps.nonreactive deps.js:364doRender view.js:197(anonymous function) view.js:142Blaze.withCurrentView view.js:375viewAutorun view.js:141Deps.Computation._compute deps.js:196Deps.Computation deps.js:130Deps.autorun deps.js:344Blaze.View.autorun view.js:140(anonymous function) view.js:188Deps.nonreactive deps.js:364Blaze.materializeView view.js:187Blaze.DOMMaterializer.def.visitObject materializer.js:116HTML.Visitor.def.visit visitors.js:61Blaze.DOMMaterializer.def.visitArray materializer.js:21HTML.Visitor.def.visit visitors.js:59doMaterialize view.js:199Deps.nonreactive deps.js:364
Here are my packages:
standard-app-packages 1.0.0 Include a standard set of Meteor packa...
less 1.0.6 The dynamic stylesheet language
natestrauser:connection-banner 0.4.3 A banner that displays when meteor ser...
mystor:device-detection 0.2.0 Client-Side Device Type Detection & Te...
raix:famono 0.7.4* Library bundler supports use of librar...
iron:router 0.9.1 Routing specifically designed for Meteor
iron:layout 0.3.0 Dynamic layouts which enable rendering...
mizzao:bootstrap-3 3.2.0 HTML, CSS, and JS framework for develo...
accounts-base 1.0.0 A user account system
accounts-password 1.0.0 Password support for accounts
mrt:accounts-ui-bs3-and-blaze 0.4.2 Bootstrap styled version of login widgets
famous-components 0.0.23 Blaze Views for Famous; doing Famous ...
I'm on Ubuntu 14.04 64-bit.
What seems to be the error behind this? Any help would be very much appreciated.
Thanks in advance.
Behind a corporate proxy so can't use meteor add directly, this repo is behind?
Get following error when installed manually with all of the iron-router packages.
TypeError: Object [object Object] has no method '_setLookupHost'
at [object Object].Controller (packages/iron:controller/lib/controller.js:25:1)
at new Controller.extend.constructor (packages/iron:router/lib/route_controller.js:14:1)
at [object Object].ctor (packages/iron:core/lib/iron_core.js:88:1)
at Function.Router.createController (packages/iron:router/lib/router.js:201:1)
at Function.Router.dispatch (packages/iron:router/lib/router_server.js:39:1)
at Object.router (packages/iron:router/lib/router.js:15:1)
FYI changed code in package.js to
Package.describe({
summary: 'Dynamic layouts which enable rendering dynamic templates into regions on a page.',
version: '1.0.8', //1.0.0-pre3
git: 'https://github.com/eventedmind/iron-layout',
name: 'iron:layout'
});
I woked out this simple case for showcasing the problem
template(name='dynamic_template')
h4 region1
+yield 'region1'
h4 main
// without the main yield no region is rendered at all
+yield
h4 region2
+yield 'region2'
template(name='dynamic_template_caller')
+Layout template='dynamic_template' data=something
|main
+contentFor 'region1'
|content of region 1
+contentFor 'region2'}}
|content of region 2
+yield
) neither +yield 'region1'
nor +yield 'region1'
are rendered
hasRegion 'region1'
helper returns false in this case.+yield
back in renders all three correctly.Should dynamic templates with only named regions (=without a main region) be supported ?
EDIT : rephrasing made clear in which case hasregion is not supported
After upgrading to Meteor 1.2, the following error shows:
Exception in callback of async function: ReferenceError: Deps is not defined
at Layout.beginRendering (http://192.168.56.101:4500/packages/iron_layout.js?e780915e25c3eabb4e4cf232e4a5135d85f05020:290:3)
at Controller.beginRendering (http://192.168.56.101:4500/packages/iron_controller.js?9d2e717544918c706f196546cf95012eaae0fb76:292:23)
at RouteController._runRoute (http://192.168.56.101:4500/packages/iron_router.js?dd5fa02859b6335661b94134bd9903be8eecf44d:472:8)
at Function.Route.dispatch (http://192.168.56.101:4500/packages/iron_router.js?dd5fa02859b6335661b94134bd9903be8eecf44d:856:18)
at route (http://192.168.56.101:4500/packages/iron_router.js?dd5fa02859b6335661b94134bd9903be8eecf44d:713:11)
at boundNext (http://192.168.56.101:4500/packages/iron_middleware-stack.js?ff70621b6c5f6a406edc60600c4b76126dae21d6:425:31)
at Meteor.bindEnvironment (http://192.168.56.101:4500/packages/meteor.js?637cc835a2ee4a2302a010c9a4c97b906db5f41c:1007:22)
at boundNext (http://192.168.56.101:4500/packages/iron_middleware-stack.js?ff70621b6c5f6a406edc60600c4b76126dae21d6:372:14)
at Meteor.bindEnvironment (http://192.168.56.101:4500/packages/meteor.js?637cc835a2ee4a2302a010c9a4c97b906db5f41c:1007:22)
at boundNext (http://192.168.56.101:4500/packages/iron_middleware-stack.js?ff70621b6c5f6a406edc60600c4b76126dae21d6:372:14)
at this line:
Deps.afterFlush(this._finishRenderingTransaction);
It doesn't appear that reverse compatibility should have been broken in Meteor 1.2, so I'm not sure what is causing this.
I am confused, is that included in https://atmospherejs.com/package/iron-router ?
At the page https://atmospherejs.com/package/blaze-layout it is said that it is included in iron-router
. So why another one?
I'll build the repro later today, but here's the bug:
Throws "You called beginRendering again before calling endRendering" error:
Router.map(function () {
this.route('landingPage', {
path: '/',
action: function () {
if (Meteor.user()) {
this.redirect(nonreactiveFunctionThatGivesMeAPath());
} else {
this.render();
}
}
});
});
Does not throw error, does the same thing:
Router.map(function () {
this.route('landingPage', {
path: '/',
waitOn: function() {
// Gets the user data
return Meteor.subscribe('me');
},
action: function () {
// Wait until I actually have data
if (this.ready()) {
// Now check if I'm logged in, non-reactively
var user;
Deps.nonreactive(function() {
user = Meteor.user();
});
if (user) {
this.redirect(nonreactiveFunctionThatGivesMeAPath());
} else {
this.render();
}
} else {
this.render();
}
}
});
});
I'm inching towards it...
While building package `iron-layout`:
error: no such package: 'blaze-layout'
My smart.json:
{
...
"iron-router": {
"git": "https://github.com/EventedMind/iron-router.git",
"branch": "feature/iron-layout"
}
...
}
I have had this problem since updating a day ago. No templates work I have tried my code and the microscope git code only the head has anything in it the body is empty on client. I would go back to a older version but I was dumb and tried deleting and reinstalling meteor so I can't please fix this Thanks
I just closed it because it randomly stopped but it randomly just started aging.
Off the top of my head:
{{#with}}
around a {{> yield}}
{{#with}}
around a {{> yield}}
, and the data is set via {{#contentFor data=X}}
{{#with}}
, and no data is set.How to install with meteor
and not mrt
since I'm on 0.9.0?
iron-layout depends on blaze-layout, so both of them must be installed, however:
=> Errors prevented startup:
While building the application:
error: circular dependency between packages blaze-layout and iron-router
error: circular dependency between packages blaze-layout and iron-layout
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.