bikeshaving / crank

The Just JavaScript Framework
https://crank.js.org
MIT License
2.69k stars 76 forks source link

Restart generator components which return when re-rendered #240

Closed brainkim closed 1 year ago

brainkim commented 1 year ago

The behavior of generator components not rendering or getting stuck after they return is confusing, and not useful, especially when you’re quickly refactoring from function components to generator components. The problem is that the getting stuck behavior doesn’t provide any hints to the developer about where the component is stuck, which makes finding returned generator components extremely difficult. I’m also pretty sure there are no valid use-cases for the current behavior.

We should consider making it so that generator components which return are restarted when re-rendered. This would allow developers to at least see that the generator component is executing.

Additionally, it might make sense to emit a console warning when generator components return early, though I’m not as sure about this last part. A console warning would only make sense if there are no conceivable use-cases for returning from a generator component.

brainkim commented 1 year ago

Changed in 0.5.0