Xiphe / remix-island

utils to render remix into a dom-node instead of the whole document
MIT License
131 stars 7 forks source link

`renderHeadToString()` requires head component to be called `Head` #6

Closed moishinetzer closed 1 year ago

moishinetzer commented 1 year ago

It seems odd to have the name of the component required to be Head when inherently it's just a component that is being passed in.

(And the error isn't so pretty either)

Argument of type '{ request: Request; remixContext: EntryContext; OtherHead: HeadComponent; }' is not assignable to parameter of type 'RenderHeadToStringOpts'.
  Object literal may only specify known properties, and 'OtherHead' does not exist in type 'RenderHeadToStringOpts'.ts(2345)
Xiphe commented 1 year ago

Wich name would you prefer?

You should already be able to use whatever name you like - you need to pass it as "Head", though: renderHeadToString({ request, remixContext, Head: OtherHead });

Xiphe commented 1 year ago

Also you can not pass any Component here. It explicitly needs to be the one created by createHead otherwise some of the magic won't work

moishinetzer commented 1 year ago

Oh I didn't realise it was an object param! My bad, that makes total sense

P.S. awesome project thanks for making this!