Skip to content

Commit

Permalink
fix: re-load doc card when reference changes
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenle committed Feb 23, 2024
1 parent 0a97e02 commit 4baddc5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/rare-rice-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@blinkk/root-cms': patch
---

re-load doc card when reference changes
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ ReferenceField.Preview = (props: ReferencePreviewProps) => {
const [previewDoc, setPreviewDoc] = useState<any>(null);

async function fetchDocData() {
setLoading(true);
const docRef = getDraftDocRef(props.id);
const doc = await getDoc(docRef);
const docData = doc.data();
Expand All @@ -106,7 +107,7 @@ ReferenceField.Preview = (props: ReferencePreviewProps) => {
return;
}
fetchDocData();
}, []);
}, [props.id]);

return (
<div className="ReferenceField__Preview">
Expand Down

0 comments on commit 4baddc5

Please sign in to comment.