Skip to content

VIDCS-3442: Refactor session context #155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 56 commits into
base: develop
Choose a base branch
from

Conversation

cpettet
Copy link
Contributor

@cpettet cpettet commented Apr 30, 2025

What is this PR doing?

Refactors the session context so that the Vonage Video API parts are inside a separate non-react, plain-old JavaScript TypeScript class. This will allow for easier testing in the future, e.g. captions 👀 . We talked about doing this since the pinning PR since that was running into issues with mocking.

note: I force-pushed the wrong commit and had to open a new PR, some (addressed) comments are here: #140

How should this be manually tested?

  • checkout this branch
  • pub/sub in a room with a few users

What are the relevant tickets?

A maintainer will add this ticket number.

Resolves VIDCS-3442

Checklist

[✅] Branch is based on develop (not main).
[ ] Resolves a Known Issue.
[ ] If yes, did you remove the item from the docs/KNOWN_ISSUES.md?
[ ] Resolves an item reported in Issues.
If yes, which issue? Issue Number?

dwivedisachin and others added 30 commits January 30, 2025 23:00
VIDCS-3292: Push the new workflow and fixes to main
VIDCS-3367: Update main branch for VERA 1.0.1
VIDCS-3438: Update main branch for VERA 1.0.2
…ss, start replacing with class methods where appropriate
…to cpettet/vidcs-3442-refactor-session-context
…ss, start replacing with class methods where appropriate
@github-actions github-actions bot changed the base branch from main to develop April 30, 2025 20:56
Comment on lines -110 to -117
useEffect(() => {
session?.on('signal', emojiHandler);

return () => {
session?.off('signal', emojiHandler);
};
}, [emojiHandler, session]);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We handle this in the session context. Removing this silences the event listener console warning.

Comment on lines -55 to -56
changedStream: null | ChangedStreamType;
connections: null | Connection[];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two weren't used anywhere.

Comment on lines 251 to 268
/**
* Handles the creation of a new connection. Adding it to the connection array
* @param {ConnectionEventType} e - The connection event object.
*/
const handleConnectionCreated = (e: ConnectionEventType) => {
setConnections((prevConnections) => [...prevConnections, e.connection]);
};

/**
* Handles the destruction of a connection. Removing it from the connections array
* @param {ConnectionEventType} e - The connection event object.
*/
const handleConnectionDestroyed = (e: ConnectionEventType) => {
setConnections((prevConnections) =>
[...prevConnections].filter(
(connection) => connection.connectionId !== e.connection.connectionId
)
);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two weren't used at all. It may have been leftovers from our call data function from the beginning.

@cpettet cpettet force-pushed the cpettet/vidcs-3442-refactor-session-context branch 2 times, most recently from 2dbfba4 to 177d926 Compare April 30, 2025 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants