useDailyEvents not emitting "joined-meeting" event on Call.js view
Hi,
using the daily react hooks, the useDailyEvents hook is not emitting the "joined-meeting" event on the Call.js view.
I tested this behaviour with the actual repository, and latest versions:
"@daily-co/daily-js": "^0.44.1",
"@daily-co/daily-react": "^0.7.3"
Thanks
Comments
-
Hi @Daniel808,
this sounds like the
Call
component, where the event listener is being setup from, might be rendered after thejoined-meeting
event was already emitted.Can you verify the event is emitted in a component higher up in the component tree?
It's important to know that event listeners setup using the
useDailyEvent
anduseThrottledDailyEvent
hooks are time-sensitive, meaning that they are setup at the time the component or hook using them renders.0 -
The useDailyEvents should be useful in the DailyProvider Component as far as i understand it? But they are not working.
0 -
All hooks contained in the Daily React library only really work, when called from a component rendered inside the
DailyProvider
. The component that rendersDailyProvider
itself, can't utilize the hooks, because it's missing the contexts created byDailyProvider
.So e.g. this does not work:
const App = ({ children }) ⇒ { // ❌ No event context useDailyEvent('joined-meeting', useCallback(…)); return ( <DailyProvider> {children} </DailyProvider> ) }
But this does:
const MainHandlers = () ⇒ { // ✅ Rendered inside DailyProvider useDailyEvent('joined-meeting', useCallback(…)); } const App = ({ children }) ⇒ { return ( <DailyProvider> <MainHandlers /> {children} </DailyProvider> ) }
Hope this clarifies it a bit. Let me know if there's any further questions!
Christian
0