Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Refactor to calculate this.data at render time #264

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

Refactor to calculate this.data at render time #264

tmeasday opened this issue Oct 12, 2016 · 1 comment

Comments

@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
Copy link
Contributor

@tmeasday YES!! I love this idea!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants