cache bug
einsqing opened this issue · comments
koa.use(convert(hbs.middleware({
extname: '.html',
viewPath: ['./www/admin', './www/home'],
layoutsPath: './www',
partialsPath: ['./www/admin', './www/home'],
disableCache: true
})));
koa.use(async(ctx, next) => {
const render = ctx.render;
ctx.render = async function _convertedRender() {
return co.call(ctx, render.apply(ctx, arguments))
}
await next();
});
###render###
if(ctx.query.type){
ctx.state = {
layout: 'admin/override'
};
}
await ctx.render('index_index');
If I open the cache, view rendering not to come out, when I closed the cache, the view can render.
I'm not sure I understand. could you rephrase?
I recorded a GIF
http://www.wemallshop.com/hbs.gif
so that looks like a koa2 issue. support for that is hacked together with koa-convert and some middleware trickery, but it's not built in. if you find a solution, I'd be happy to add it to the readme. but this might have to wait until Koa2 support is official.
After using async/await rewrite koa-hbs, I found this not koa or koa-convert bug, this is my own writing async function called dynamic, not await.Contribute a koa-hbs for koa2 https://github.com/einsqing/koa2-hbs