From 05dc5df3f80566e08dd7aa53f3b9f20bf5f68472 Mon Sep 17 00:00:00 2001 From: fahed Date: Tue, 10 Mar 2026 15:37:34 +0300 Subject: [PATCH] fix: persist artefact review link by deriving URL from approval_token Previously the review URL was only stored in component state and lost when the panel was reopened. Now derives it from the artefact's approval_token field, matching how PostDetailPanel works. Co-Authored-By: Claude Opus 4.6 --- client/src/components/ArtefactDetailPanel.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/src/components/ArtefactDetailPanel.jsx b/client/src/components/ArtefactDetailPanel.jsx index 12d26e3..648797e 100644 --- a/client/src/components/ArtefactDetailPanel.jsx +++ b/client/src/components/ArtefactDetailPanel.jsx @@ -40,7 +40,7 @@ export default function ArtefactDetailPanel({ artefact, onClose, onUpdate, onDel const [versionData, setVersionData] = useState(null) const [loading, setLoading] = useState(true) const [submitting, setSubmitting] = useState(false) - const [reviewUrl, setReviewUrl] = useState('') + const [freshReviewUrl, setFreshReviewUrl] = useState('') const [copied, setCopied] = useState(false) const [activeTab, setActiveTab] = useState('details') @@ -52,6 +52,7 @@ export default function ArtefactDetailPanel({ artefact, onClose, onUpdate, onDel const [editApproverIds, setEditApproverIds] = useState( artefact.approvers?.map(a => String(a.id)) || (artefact.approver_ids ? artefact.approver_ids.split(',').map(s => s.trim()).filter(Boolean) : []) ) + const reviewUrl = freshReviewUrl || (artefact.approval_token ? `${window.location.origin}/review/${artefact.approval_token}` : '') const [savingDraft, setSavingDraft] = useState(false) const [deleting, setDeleting] = useState(false) const [confirmDeleteLangId, setConfirmDeleteLangId] = useState(null) @@ -245,7 +246,7 @@ export default function ArtefactDetailPanel({ artefact, onClose, onUpdate, onDel setSubmitting(true) try { const res = await api.post(`/artefacts/${artefact.Id}/submit-review`) - setReviewUrl(res.reviewUrl || res.data?.reviewUrl || '') + setFreshReviewUrl(res.reviewUrl || res.data?.reviewUrl || '') toast.success(t('artefacts.submittedForReview')) onUpdate() } catch (err) {