Skip to content

Commit

Permalink
fix title and update title not working in detail article
Browse files Browse the repository at this point in the history
  • Loading branch information
muzanella11 committed Sep 25, 2024
1 parent 05e328f commit a009447
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions apps/cms/src/app/(protected)/content/article/[documentId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,9 @@ export default function DocumentDetailsPage() {

useEffect(() => {
if (updateTitleShown) return;
async function onDocumentTitleChange(title: string) {
console.log("[onDocumentTitleChange]", title);
if (!document) {
return;
}

document.data.title = title;
await update(document);
}

onDocumentTitleChange(title);
}, [document, title, update, updateTitleShown]);
}, [updateTitleShown]);

useEffect(() => {
if (document) {
Expand All @@ -49,6 +40,16 @@ export default function DocumentDetailsPage() {
return () => setTitle("");
}, [document]);

async function onDocumentTitleChange(title: string) {
console.log("[onDocumentTitleChange]", title);
if (!document) {
return;
}

document.data.title = title;
await update(document);
}

async function onDocumentContentChange(content: string) {
console.log("[onDocumentContentChange]", content);
if (!document) {
Expand Down

0 comments on commit a009447

Please sign in to comment.