Skip to content
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

immutagen execute all generator for any component (accumulates all calls) #2

Open
gtkatakura opened this issue Sep 6, 2018 · 2 comments

Comments

@gtkatakura
Copy link

gtkatakura commented Sep 6, 2018

const App = regenerator(function*() {
  console.log('This code snippet is called each time the component Time is updated')
  console.log('This behavior occurs because of immutagen')

  const { loading, data } = yield props => <Query {...props} />;
  const { time } = yield props => <Time {...props} />;

  // If you uncomment this code, there will be two calls of the whole code with each
  // update of the Time
  // yield ({ children }) => <div>{children()}</div>

  return (
    <div className="App">
      {loading ? (
        <h1>Loading</h1>
      ) : (
        <div>
          <h1>{`Hello, ${data.user.name}`}</h1>
          <h2>The time is {time.toLocaleString()}!</h2>
        </div>
      )}
    </div>
  );
});
@gtkatakura gtkatakura changed the title immutagen execute all generator for any HOC (accumulates all calls) immutagen execute all generator for any component (accumulates all calls) Sep 6, 2018
@fakenickels
Copy link
Contributor

Thanks for
This indeed happens, still need to check if it can indeed be really problematic and/or see if we can change a bit immutagen to not need to call the generator over again

@jamiebuilds
Copy link

Making renders "resumable" would be a fairly large performance improvement if not also a memory issue

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

No branches or pull requests

3 participants