-
Notifications
You must be signed in to change notification settings - Fork 5
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
base: develop
Are you sure you want to change the base?
Conversation
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
…with types. publishing works now.
…cpettet/vidcs-3442-refactor-session-context
…to cpettet/vidcs-3442-refactor-session-context
…ss, start replacing with class methods where appropriate
…with types. publishing works now.
…com:Vonage/vonage-video-react-app into cpettet/vidcs-3442-refactor-session-context
useEffect(() => { | ||
session?.on('signal', emojiHandler); | ||
|
||
return () => { | ||
session?.off('signal', emojiHandler); | ||
}; | ||
}, [emojiHandler, session]); | ||
|
There was a problem hiding this comment.
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.
changedStream: null | ChangedStreamType; | ||
connections: null | Connection[]; |
There was a problem hiding this comment.
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.
/** | ||
* 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 | ||
) | ||
); |
There was a problem hiding this comment.
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.
2dbfba4
to
177d926
Compare
What is this PR doing?
Refactors the session context so that the Vonage Video API parts are inside a separate non-react, plain-old
JavaScriptTypeScript 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?
What are the relevant tickets?
A maintainer will add this ticket number.
Resolves VIDCS-3442
Checklist
[✅] Branch is based on
develop
(notmain
).[ ] 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?