fix: timers type in browser env (#3875)

(cherry picked from commit fc9981335b)
This commit is contained in:
Camol
2023-08-22 03:14:25 +08:00
committed by Alex Yang
parent 96dcd84ee1
commit 9eee00ddf3
11 changed files with 19 additions and 19 deletions
@@ -70,7 +70,7 @@ const NameWorkspaceContent = ({
<Input
ref={ref => {
if (ref) {
setTimeout(() => ref.focus(), 0);
window.setTimeout(() => ref.focus(), 0);
}
}}
data-testid="create-workspace-input"
@@ -82,7 +82,7 @@ export const WorkspaceDeleteModal = ({
<Input
ref={ref => {
if (ref) {
setTimeout(() => ref.focus(), 0);
window.setTimeout(() => ref.focus(), 0);
}
}}
onChange={setDeleteStr}
@@ -106,7 +106,7 @@ const EditorWrapper = memo(function EditorWrapper({
const rootStore = getCurrentStore();
const editorItems = rootStore.get(pluginEditorAtom);
let disposes: (() => void)[] = [];
const renderTimeout = setTimeout(() => {
const renderTimeout = window.setTimeout(() => {
disposes = Object.entries(editorItems).map(([id, editorItem]) => {
const div = document.createElement('div');
div.setAttribute('plugin-id', id);
@@ -123,7 +123,7 @@ const EditorWrapper = memo(function EditorWrapper({
return () => {
dispose();
clearTimeout(renderTimeout);
setTimeout(() => {
window.setTimeout(() => {
disposes.forEach(dispose => dispose());
});
};
@@ -165,7 +165,7 @@ const PluginContentAdapter = memo<PluginContentAdapterProps>(
};
const dispose = addCleanup(pluginName, cl);
abortController.signal.addEventListener('abort', () => {
setTimeout(() => {
window.setTimeout(() => {
dispose();
cl();
});