New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor to calculate `this.data` at render time #264

Closed
tmeasday opened this Issue Oct 12, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@tmeasday
Copy link
Contributor

tmeasday commented Oct 12, 2016

It seems like we are going through some contortions to keep this.data up to date, which seems unnecessary given we can now call this.queryObservable.currentResult() in the render function to get the current data.

So I would suggest something like:

render() {
  let data;
  if (/*skipping*/) {
    data = { loading: false, errors: null };
  } else {
    data = assign({}, this.queryObservable.currentResult());
    // copy fields over from queryObservable
  }

  // now render wrappedComponent with data
}
@jbaxleyiii

This comment has been minimized.

Copy link
Member

jbaxleyiii commented Oct 12, 2016

@tmeasday YES!! I love this idea!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment