Merge pull request #4117 from matrix-org/bwindels/fixinfinispinneronencryptioninfo
update phase when request prop changes
This commit is contained in:
commit
2b61988d30
1 changed files with 6 additions and 3 deletions
|
@ -32,11 +32,14 @@ const MISMATCHES = ["m.key_mismatch", "m.user_error", "m.mismatched_sas"];
|
||||||
|
|
||||||
const EncryptionPanel = ({verificationRequest, member, onClose, layout}) => {
|
const EncryptionPanel = ({verificationRequest, member, onClose, layout}) => {
|
||||||
const [request, setRequest] = useState(verificationRequest);
|
const [request, setRequest] = useState(verificationRequest);
|
||||||
useEffect(() => {
|
|
||||||
setRequest(verificationRequest);
|
|
||||||
}, [verificationRequest]);
|
|
||||||
|
|
||||||
const [phase, setPhase] = useState(request && request.phase);
|
const [phase, setPhase] = useState(request && request.phase);
|
||||||
|
useEffect(() => {
|
||||||
|
setRequest(verificationRequest);
|
||||||
|
if (verificationRequest) {
|
||||||
|
setPhase(verificationRequest.phase);
|
||||||
|
}
|
||||||
|
}, [verificationRequest]);
|
||||||
const changeHandler = useCallback(() => {
|
const changeHandler = useCallback(() => {
|
||||||
// handle transitions -> cancelled for mismatches which fire a modal instead of showing a card
|
// handle transitions -> cancelled for mismatches which fire a modal instead of showing a card
|
||||||
if (request && request.cancelled && MISMATCHES.includes(request.cancellationCode)) {
|
if (request && request.cancelled && MISMATCHES.includes(request.cancellationCode)) {
|
||||||
|
|
Loading…
Reference in a new issue