hyperstack-org / hyperstack

Hyperstack ALPHA https://hyperstack.org
https://docs.hyperstack.org
MIT License
540 stars 41 forks source link

Reloader applies imports more than once #177

Open joshleblanc opened 5 years ago

joshleblanc commented 5 years ago

I have the following method in my HyperComponent.rb

  def self.decorate(decorator)
    imports `decorator(#{self.to_n})`
  end
class AccountForm < HyperComponent
  decorate `Mui.withStyles(styles, { withTheme: true })`

  # snip
end

I use this inside of components to deceore them with higher order components. Whenever the reloader reloads the component, it applies the import again, resulting in very large trees.

First render: image

After 10 reloads: image

catmando commented 5 years ago

That is a pretty cool use case!