algolia / recommend

A UI library for Algolia Recommend, available for Vanilla JavaScript and React.
https://www.algolia.com/doc/ui-libraries/recommend/introduction/what-is-recommend/
MIT License
28 stars 11 forks source link

fix: remove vdom renderer from react props #140

Closed raed667 closed 1 year ago

raed667 commented 1 year ago

As internally reported by @sarahdayan

There seems to be an issue with the types in @algolia/recommend-react for the view prop in the RelatedProducts component. It requires a renderer (createElement and Fragment) which seems to be inherited from the underlying VDOM package (which makes sense) but in React the renderer shouldn't be required since it's provided.

The proposed fix is to omit Rendererprops from the react components.

raed667 commented 1 year ago

@sarahdayan excellent suggestion ! 👍

I'll publish this fix for now, and do a follow-up PR

francoischalifour commented 1 year ago

We could even create the type to apply to all components props:

type ExtractComponentProps<TType> = Omit<
  TType,
  'items' | 'status' | 'createElement' | 'Fragment'
>