Skip to content

Commit afd1d59

Browse files
author
Ian Wensink
committed
feat(styled-components): fix SSR issues
1 parent 9205514 commit afd1d59

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/Webform/index.jsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,6 @@ class Webform extends Component {
9999

100100
this.key = props.form.form_id;
101101

102-
/**
103-
* @var {Form}
104-
*/
105-
this.formStore = this.getFormstore(props);
106-
107102
this.onSubmit = this.onSubmit.bind(this);
108103
this.converted = this.converted.bind(this);
109104
this.submit = this.submit.bind(this);
@@ -115,6 +110,13 @@ class Webform extends Component {
115110
if(GTM) {
116111
GoogleTag.addTag(GTM);
117112
}
113+
114+
// TODO: create formStore in willMount to support SSR
115+
/**
116+
* @var {Form}
117+
*/
118+
this.formStore = this.getFormstore(this.props);
119+
this.forceUpdate();
118120
}
119121

120122
componentWillReceiveProps(nextProps) {
@@ -226,6 +228,7 @@ class Webform extends Component {
226228
}
227229

228230
render() {
231+
if(!this.formStore) return null;
229232
const formElements = this.getFormElements();
230233
const multipage = this.isMultipage();
231234

0 commit comments

Comments
 (0)