Skip to content
This repository was archived by the owner on Jul 22, 2020. It is now read-only.

Commit 2c68344

Browse files
author
Mihkel Eidast
committed
Merge branch 'next' into develop
# Conflicts: # package.json
2 parents f2d795d + 7b0b6cc commit 2c68344

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

src/helpers/context-data.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ module.exports = function(fractal){
2020
if (!entity) {
2121
throw new Error(`Could not get context for component '${handle}' - component not found.`);
2222
}
23-
const defaultContext = entity.isComponent ? entity.variants().default().context : entity.context;
24-
return source.resolve(_.defaultsDeep(context || {}, defaultContext));
23+
const defaultContext = entity.isComponent ? entity.variants().default().getContext() : entity.getContext();
24+
return _.defaultsDeep(context || {}, defaultContext);
2525
};
2626

2727
};

src/helpers/context.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ module.exports = function(fractal){
1010
if (!entity) {
1111
throw new Error(`Could not get context for component '${handle}' - component not found.`);
1212
}
13-
const context = entity.isComponent ? entity.variants().default().context : entity.context;
14-
return source.resolve(context).then(ctx => new Handlebars.SafeString(JSON.stringify(ctx, null, 4)));
13+
const context = entity.isComponent ? entity.variants().default().getContext() : entity.getContext();
14+
return new Handlebars.SafeString(JSON.stringify(context, null, 4));
1515
};
1616

1717
};

src/helpers/render.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,21 @@ module.exports = function(fractal){
2424
if (!entity) {
2525
throw new Error(`Could not render component '${handle}' - component not found.`);
2626
}
27-
const defaultContext = entity.isComponent ? entity.variants().default().context : entity.context;
27+
const defaultContext = entity.isComponent ? entity.variants().default().getContext() : entity.getContext();
2828
if (!context) {
2929
context = defaultContext;
3030
} else if (merge) {
3131
context = utils.defaultsDeep(context, defaultContext);
3232
}
33-
33+
3434
return source.resolve(context).then(context => {
3535
// fix env for rendered components
3636
let env = JSON.parse(JSON.stringify(root._env));
3737
_.set(context, '_env', env);
3838

39-
return entity.render(context).then(html => new Handlebars.SafeString(html));
39+
return entity.render(context).then(html => new Handlebars.SafeString(html)).catch(err => {});
4040
});
41+
4142
};
4243

4344
};

0 commit comments

Comments
 (0)