Extract IncomingCallToast ring/lifecycle logic into useIncomingCallToast hook#34199
Extract IncomingCallToast ring/lifecycle logic into useIncomingCallToast hook#34199syphernl wants to merge 2 commits into
Conversation
…ast hook No behavioural change: pulls the ring/timeout/auto-dismiss lifecycle and join/decline actions out of IncomingCallToast into a reusable hook, so a future prominent (full-screen) incoming-call surface can share the same logic instead of duplicating it. Signed-off-by: Frank Klaassen <639906+syphernl@users.noreply.github.com>
Half-Shot
left a comment
There was a problem hiding this comment.
I see there are a few minor changes beyond the extraction, but I think the extraction warrants a standalone test suite.
| @@ -0,0 +1,247 @@ | |||
| /* | |||
There was a problem hiding this comment.
Tests for this as a standalone thing wouldn't go amiss, if you could write a vitest format test (useIncomingCallToast.test.tsx) then that would help I think.
Also, does this need to be a TSX?
There was a problem hiding this comment.
No it doesn't have to be TSX, changed it.
I kept the test in Jest because the MockedCall/useMockedCalls/WidgetMessagingStore still relies on the global jest object, which isn't available within the Vitest config of this repo. Hope that's fine.
There was a problem hiding this comment.
Ahhhhhhhhhh yes, I shan't ask you to start rewriting our tests for this :). Having it standalone means we can fix this up in the future anyway, so thanks!
Addresses review feedback on element-hq#34199: the extracted hook had no test coverage of its own (only exercised indirectly via IncomingCallToast), and did not need JSX so .tsx was unnecessary. Signed-off-by: Frank Klaassen <639906+syphernl@users.noreply.github.com>
Summary
Pulls the ring/timeout/auto-dismiss lifecycle and join/decline actions out of
IncomingCallToastinto a reusableuseIncomingCallToasthook. No behavioural change.Split out of #34171 (prominent full-screen incoming-call notification) to keep that PR's diff reviewable. The hook is needed there to share ring/timeout/auto-dismiss logic between the existing toast and the new full-screen surface.
Test plan
IncomingCallToast-test.tsxsuite passes unchanged (20/20)tsc --noEmitclean