Skip to content
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

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

Conversation

uhoreg
Copy link
Member

@uhoreg uhoreg commented Nov 8, 2024

Fixes #28164

Checklist

  • Tests written for new code (and old code if feasible).
  • New or updated public/exported symbols have accurate TSDoc documentation.
  • Linter and other CI checks pass.
  • I have licensed the changes to Element by completing the Contributor License Agreement (CLA)

@uhoreg uhoreg added the T-Defect label Nov 8, 2024
Copy link
Member

@t3chguy t3chguy left a comment

Choose a reason for hiding this comment

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

LGTM otherwise

throttle(
() => {
if (client.getCrypto()) {
console.log("getting status");
Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member

@BillCarsonFr BillCarsonFr left a 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]);
Copy link
Member

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?

Copy link
Member

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.

@uhoreg
Copy link
Member Author

uhoreg commented Nov 8, 2024

There are no test for membership changes?

There is a test for membership changes at https://github.com/element-hq/element-web/pull/28407/files#diff-5463cabfb673ce908cb151cfb23ca1085a6a510c7d9f897c76379408ace43fe3R652-R671

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Verification | Unexpected verified badge in DM title bar on the other user avatar
3 participants