-
-
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
Replace MatrixClient.isRoomEncrypted
by MatrixClient.CryptoApi.isEncryptionEnabledInRoom
in useIsEncrypted
#28282
Replace MatrixClient.isRoomEncrypted
by MatrixClient.CryptoApi.isEncryptionEnabledInRoom
in useIsEncrypted
#28282
Conversation
…ncryptionEnabledInRoom` in `useIsEncrypted`
…e-useIsEncryped-isroomencrypted
src/hooks/useIsEncrypted.ts
Outdated
try { | ||
setIsEncrypted(await cli.getCrypto()?.isEncryptionEnabledInRoom(room.roomId)); | ||
} catch { | ||
setIsEncrypted(false); |
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.
if encrypted
is true and the room didn't change but isEncryptionEnabledInRoom
threw should we really be setting to false? This seems unexpected.
We probably also need to reset to null
when room changes whilst func
is calling the async function which could take multiple ticks
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.
Could probably be also done like this:
const encryptionStateEvent = useRoomState(...);
return useAsyncMemo(() => {...}, [room, encryptionStateEvent]);
Are you suggesting to get the encryption state event with |
Yes but it'll be the dependency for |
c1f7a67
to
0ee713a
Compare
Checklist
public
/exported
symbols have accurate TSDoc documentation.Task #26922