Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

fix(desktop): avoid WebKit crash when reordering files (#8318)

Nimesh Sharma51d5ee759a10
diff --git a/frontend/editor/src/core/components/fileEditor/FileEditor.tsx b/frontend/editor/src/core/components/fileEditor/FileEditor.tsx
index 420f5a81e0..07dcf561a7 100644
--- a/frontend/editor/src/core/components/fileEditor/FileEditor.tsx
+++ b/frontend/editor/src/core/components/fileEditor/FileEditor.tsx
@@ -1,5 +1,4 @@
import { useState, useCallback, useMemo, useEffect, useRef } from "react";
-import { flushSync } from "react-dom";
import { Center, Box, LoadingOverlay } from "@mantine/core";
import { useTranslation } from "react-i18next";
import {
@@ -189,18 +188,8 @@ const FileEditor = ({
newOrder.splice(insertIndex, 0, ...filesToMove);
- // flushSync commits the reorder inside the view transition so its snapshots capture both layouts.
- const applyReorder = () => reorderFiles(newOrder);
- const docWithViewTransition = document as Document & {
- startViewTransition?: (cb: () => void) => unknown;
- };
- if (typeof docWithViewTransition.startViewTransition === "function") {
- docWithViewTransition.startViewTransition(() => {
- flushSync(applyReorder);
- });
- } else {
- applyReorder();
- }
+ // View transitions can crash WebKitGTK when accelerated compositing is unavailable.
+ reorderFiles(newOrder);
const moveCount = filesToMove.length;
showStatus(