Skip to content

Commit

Permalink
Return front-matter into data object.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatahb committed Nov 30, 2022
1 parent 580ac67 commit 687bc7d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
return class LivePageComponent extends React.Component{
constructor(props) {
super(props);
this.state = {}
this.state = props.page?.data || {};
this.onLoadEventListener = (e) => {
this.onCloudCannonLoad(e.detail.CloudCannon);
};
Expand Down Expand Up @@ -51,8 +51,10 @@ module.exports = {
const hydratedProps = {
...this.props,
page: {
...processProps(this.props.page),
...this.state,
...this.props.page,
data: {
...processProps(this.state)
},
}
}
return React.createElement(Component, hydratedProps, this.props.children);
Expand Down

0 comments on commit 687bc7d

Please sign in to comment.