Skip to content

Commit e33b42f

Browse files
committed
refactor: removed auto-save functionality in editor page
1 parent 289b4de commit e33b42f

File tree

1 file changed

+1
-30
lines changed
  • surfsense_web/app/dashboard/[search_space_id]/editor/[documentId]

1 file changed

+1
-30
lines changed

surfsense_web/app/dashboard/[search_space_id]/editor/[documentId]/page.tsx

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { BlockNoteEditor } from "@/components/DynamicBlockNoteEditor";
99
import { Button } from "@/components/ui/button";
1010
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
1111
import { Separator } from "@/components/ui/separator";
12-
import { cn } from "@/lib/utils";
1312

1413
interface EditorContent {
1514
document_id: number;
@@ -97,35 +96,7 @@ export default function EditorPage() {
9796
}
9897
}, [editorContent, document]);
9998

100-
// Auto-save every 30 seconds - DIRECT CALL TO FASTAPI
101-
useEffect(() => {
102-
if (!editorContent || !token || !hasUnsavedChanges) return;
103-
104-
const interval = setInterval(async () => {
105-
try {
106-
const response = await fetch(
107-
`${process.env.NEXT_PUBLIC_FASTAPI_BACKEND_URL}/api/v1/documents/${documentId}/blocknote-content`,
108-
{
109-
method: "PUT",
110-
headers: {
111-
"Content-Type": "application/json",
112-
Authorization: `Bearer ${token}`,
113-
},
114-
body: JSON.stringify({ blocknote_document: editorContent }),
115-
}
116-
);
117-
118-
if (response.ok) {
119-
setHasUnsavedChanges(false);
120-
toast.success("Auto-saved", { duration: 2000 });
121-
}
122-
} catch (error) {
123-
console.error("Auto-save failed:", error);
124-
}
125-
}, 30000); // 30 seconds
126-
127-
return () => clearInterval(interval);
128-
}, [editorContent, documentId, token, hasUnsavedChanges]);
99+
// TODO: Auto-save every 30 seconds - DIRECT CALL TO FASTAPI
129100

130101
// Save and exit - DIRECT CALL TO FASTAPI
131102
const handleSave = async () => {

0 commit comments

Comments
 (0)