mathieuprog/polymorphic_embed

Create a separate package for view-related code

Closed this issue · 7 comments

I'd like to separate the code related to the view from the core/Ecto-related code.

Reason: while the core remains stable and should never or rarely introduce a breaking change (one of the library's core principle is to keep the API and behavior as close as possible from the Ecto embed_one/many functions, which never break), the view-related code keeps breaking and keeps introducing major versions.

I'd like to create one new package. I was thinking of the names:

  • polymorphic_embed_html
  • polymorphic_embed_view
  • polymorphic_embed_component

Which name(s) would be most suitable? Votes welcome!

I think it would make sense to mirror the naming of the Phoenix packages:

  • polymorphic_embed_html
  • polymorphic_embed_live_view

I don't see a reason for a separate component package, since everything is HEEx now, and both HEEx and Phoenix.Component are part of LiveView. And _view sounds like it would it would be related to phoenix_view, which is only for Phoenix applications before version 1.6.

Did you suggest 2 packages? I think we need only one package, as just as we said earlier, the functions in the HTML.Form are to be removed. All we have left is polymorphic_embed_inputs_for/1 currently in Component as well as a small helper function to case on the type.

Ah, I misread your suggestion. Then my preference would be polymorphic_embed_html.

Actually me too, settled:)
(edited to make more clear)

Woops, I'm late to the party. Just wanted to suggest another naming scheme:

polymorphic_embed_phoenix or phoenix_polymorphic_embed (I'd prefer the first one)

That's how the mailing libraries bamboo (https://github.com/thoughtbot/bamboo_phoenix) or swoosh (https://github.com/swoosh/phoenix_swoosh) named their libraries integrating with Phoenix. As this will use phoenix_html / phoenix_live_view (heex) for rendering, maybe including phoenix in the name would make sense?

If it's settled on polymorphic_embed_html, I think that's fine too :)

Wait that's even better. Any comment @woylie before I commit to it?:D

polymorphic_embed_phoenix sounds good to me!