hypernova-ruby icon indicating copy to clipboard operation
hypernova-ruby copied to clipboard

Can't use plugins when a certain component has two instances with the same name

Open jtamary opened this issue 8 years ago • 2 comments

Hey all,

First of all, this is a truly an awesome project!

In my project I want to render the same component twice with different props, it works really well :)

However, If I write a plugin that uses a hook that receives the components hash (such as prepare_request)

the hooks gets a hash which has only the last component. I think that the problem is https://github.com/airbnb/hypernova-ruby/blob/e6c6553a4838203f4cdd62368ba1c146f632233d/lib/hypernova/controller_helpers.rb#L82 since it overrides the key.

Just for clarification the batch is sent just fine since it creates the hash differently. https://github.com/airbnb/hypernova-ruby/blob/e6c6553a4838203f4cdd62368ba1c146f632233d/lib/hypernova/batch.rb#L45

What should I do?

Thanks, Jonathan

jtamary avatar Jun 20 '17 13:06 jtamary

Same issue here. This hash conversion is bogus. Also it takes place only to feed the hash to the plugins, the data sent to hypenova is correct as you pointout.

dtheodor avatar Oct 23 '18 09:10 dtheodor

At the moment, each top-level component needs to be unique on the page.

ljharb avatar Oct 23 '18 15:10 ljharb