mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-25 10:58:19 +01:00
Fix stuck in-call close dialog overlay when cancelling
This commit is contained in:
@@ -2,8 +2,7 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import React, { StrictMode } from 'react';
|
||||
import { unmountComponentAtNode } from 'react-dom';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import { createRoot, type Root } from 'react-dom/client';
|
||||
|
||||
import * as Errors from '../types/errors';
|
||||
import { createLogger } from '../logging/log';
|
||||
@@ -29,13 +28,14 @@ export async function longRunningTaskWrapper<T>({
|
||||
const ONE_SECOND = 1000;
|
||||
const TWO_SECONDS = 2000;
|
||||
|
||||
let progressNode: HTMLDivElement | undefined;
|
||||
let progressRoot: Root | undefined;
|
||||
let spinnerStart;
|
||||
let progressTimeout: NodeJS.Timeout | undefined = setTimeout(() => {
|
||||
progressNode = document.createElement('div');
|
||||
const progressNode = document.createElement('div');
|
||||
|
||||
log.info(`${idLog}: Creating spinner`);
|
||||
createRoot(progressNode).render(
|
||||
progressRoot = createRoot(progressNode);
|
||||
progressRoot.render(
|
||||
<StrictMode>
|
||||
<FunDefaultEnglishEmojiLocalizationProvider>
|
||||
<ProgressModal i18n={window.i18n} />
|
||||
@@ -54,7 +54,7 @@ export async function longRunningTaskWrapper<T>({
|
||||
|
||||
clearTimeoutIfNecessary(progressTimeout);
|
||||
progressTimeout = undefined;
|
||||
if (progressNode) {
|
||||
if (progressRoot) {
|
||||
const now = Date.now();
|
||||
if (spinnerStart && now - spinnerStart < ONE_SECOND) {
|
||||
log.info(
|
||||
@@ -62,8 +62,8 @@ export async function longRunningTaskWrapper<T>({
|
||||
);
|
||||
await sleep(ONE_SECOND);
|
||||
}
|
||||
unmountComponentAtNode(progressNode);
|
||||
progressNode = undefined;
|
||||
progressRoot.unmount();
|
||||
progressRoot = undefined;
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -72,9 +72,9 @@ export async function longRunningTaskWrapper<T>({
|
||||
|
||||
clearTimeoutIfNecessary(progressTimeout);
|
||||
progressTimeout = undefined;
|
||||
if (progressNode) {
|
||||
unmountComponentAtNode(progressNode);
|
||||
progressNode = undefined;
|
||||
if (progressRoot) {
|
||||
progressRoot.unmount();
|
||||
progressRoot = undefined;
|
||||
}
|
||||
|
||||
if (!suppressErrorDialog) {
|
||||
|
||||
Reference in New Issue
Block a user