Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught Error: Couldn't find a Layout component in the rendered component tree

I'm receiving an error with Iron Router 0.7.0 on Meteor 0.8.0.

Within the UI.Compenent.lookup function in blaze-layout's layout.js, the following error is triggering:

Uncaught Error: Couldn't find a Layout component in the rendered component tree

It's hard to know exactly what is causing this error and what isn't working because of it. Any ideas?

Thanks in advance.

like image 954
CDoe Avatar asked Jan 10 '23 21:01

CDoe


1 Answers

I just got the same error, for me it was caused by including my layout template within <body>, and specifying it as the layoutTemplate option. To fix it, I removed the include from <body>.

Here is a before and after of my code;

example.html (before)

<head>
  <title>example</title>
</head>

<body>
   {{>layout}}
</body>

<template name="layout">
    <div>{{>yield}}</div>
</template>

example.js (before)

if(Meteor.isClient) {

Router.configure({
    layoutTemplate: 'layout'
});

}

example.html (after)

<head>
  <title>example</title>
</head>

<body>
</body>

<template name="layout">
    <div>{{>yield}}</div>
</template>

example.js (after -- same as before)

like image 80
Michael Camden Avatar answered Apr 30 '23 02:04

Michael Camden