daily-co / daily-react

React hooks and components to get started with Daily
https://docs.daily.co/reference/daily-react
BSD 2-Clause "Simplified" License
52 stars 16 forks source link

Update DailyProvider.tsx to allow `callObject={null}` #3

Closed dherault closed 2 years ago

dherault commented 2 years ago

Add null type possibility to callObject

dherault commented 2 years ago

You can close this one, because I feel it is too opinionated.

Regaddi commented 2 years ago

@dherault Apologies for the delayed response.

I wonder what your use-case is for this. In case you want to clear out any old callObject references, before assigning a new callObject instance, you could simply pass the new callObject as soon as it's created. There is no need to actively "nullify" the old instance. This should work for any stateful representation of callObject, so let's say setCallObject exists and stores a new instance in React, as soon as React re-renders DailyProvider with the updated callObject prop, we'll let go the previous callObject reference and store the newly passed one.

Let me know in case there are any more concerns or questions.