From 9b9d0f24b54d46c24734f30ed9640d25e6c19097 Mon Sep 17 00:00:00 2001 From: Jacob Fletcher Date: Thu, 18 Feb 2021 19:06:07 -0500 Subject: [PATCH] fix: returns entire doc to generatePreviewURL callback of PreviewButton --- src/admin/components/elements/PreviewButton/index.tsx | 7 ++----- src/admin/components/elements/PreviewButton/types.ts | 5 ++++- src/admin/components/views/Account/Default.tsx | 5 ++++- src/admin/components/views/Global/Default.tsx | 7 +++++-- src/admin/components/views/collections/Edit/Default.tsx | 5 ++++- 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/admin/components/elements/PreviewButton/index.tsx b/src/admin/components/elements/PreviewButton/index.tsx index c2332603e30..c568e815a84 100644 --- a/src/admin/components/elements/PreviewButton/index.tsx +++ b/src/admin/components/elements/PreviewButton/index.tsx @@ -1,18 +1,15 @@ import React from 'react'; import { useAuth } from '@payloadcms/config-provider'; -import { useForm } from '../../forms/Form/context'; import Button from '../Button'; import { Props } from './types'; const baseClass = 'preview-btn'; -const PreviewButton: React.FC = ({ generatePreviewURL }) => { +const PreviewButton: React.FC = ({ generatePreviewURL, data }) => { const { token } = useAuth(); - const { getFields } = useForm(); - const fields = getFields(); if (generatePreviewURL && typeof generatePreviewURL === 'function') { - const previewURL = generatePreviewURL(fields, token); + const previewURL = generatePreviewURL(data, token); return (