-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Listen to events so that encryption icon updates when status changes #28407
base: develop
Are you sure you want to change the base?
Conversation
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.
LGTM otherwise
src/hooks/useEncryptionStatus.ts
Outdated
throttle( | ||
() => { | ||
if (client.getCrypto()) { | ||
console.log("getting status"); |
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.
this is not a helpful console message
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.
ugh. I thought I removed all my debugging messages, but I forgot that one.
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.
Can't say much about react stuffs :/
There are no test for membership changes?
[client, room], | ||
); | ||
|
||
useEffect(updateEncryptionStatus, [updateEncryptionStatus]); |
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.
I am not familiar with that, the second arg are dependencies? So is this not a cyclic dependencies?
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.
the dependencies specify when useEffect
should be called. So this says call updateEncryptionState
whenever the method changes, and the method is a useMemo with its own dependencies, so it changes when [client, room]
(either) changes.
There is a test for membership changes at https://github.com/element-hq/element-web/pull/28407/files#diff-5463cabfb673ce908cb151cfb23ca1085a6a510c7d9f897c76379408ace43fe3R652-R671 |
Fixes #28164
Checklist
public
/exported
symbols have accurate TSDoc documentation.