diff --git a/apps/web/src/components/diff-viewer/index.tsx b/apps/web/src/components/diff-viewer/index.tsx
index 6bb4b9637..d9a18c456 100644
--- a/apps/web/src/components/diff-viewer/index.tsx
+++ b/apps/web/src/components/diff-viewer/index.tsx
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { useState } from "react";
+import { useLayoutEffect, useState } from "react";
import { Flex, Text, Button } from "@theme-ui/components";
import { Loading, ImageDownload, Copy, Restore } from "../icons";
import ContentToggle from "./content-toggle";
@@ -45,6 +45,13 @@ function DiffViewer(props: DiffViewerProps) {
content.conflicted
);
+ useLayoutEffect(() => {
+ setConflictedContent((c) => {
+ if (c?.dateEdited === session.content.conflicted?.dateEdited) return c;
+ return session.content.conflicted;
+ });
+ }, [session]);
+
if (!conflictedContent) return null;
return (
@@ -242,7 +249,8 @@ function DiffViewer(props: DiffViewerProps) {
content.data}
- nonce={0}
+ session={session}
+ nonce={content.dateEdited}
options={{ readonly: true, headless: true }}
/>
@@ -316,8 +324,9 @@ function DiffViewer(props: DiffViewerProps) {
conflictedContent.data}
- nonce={0}
+ nonce={conflictedContent.dateEdited}
options={{ readonly: true, headless: true }}
/>