Skip to content

Commit

Permalink
fix: modal x button cancels changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Byrne committed Mar 24, 2021
1 parent 4906fa6 commit 258d190
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/react-tinacms-inline/src/inline-settings.tsx
Expand Up @@ -77,10 +77,9 @@ export function SettingsModal({
const { form } = useInlineForm()
const { name } = React.useContext(InlineFieldContext)
const [initialValues] = React.useState(form.values)
console.log(form, name)

function handleCancel(event: any) {
event.stopPropagation()
event.preventDefault()
function handleCancel() {
form.updateValues(initialValues)
close()
}
Expand Down Expand Up @@ -110,7 +109,7 @@ export function SettingsModal({
return (
<Modal id="tinacms-inline-settings" onClick={e => e.stopPropagation()}>
<ModalPopup>
<ModalHeader close={close}>{title}</ModalHeader>
<ModalHeader close={handleCancel}>{title}</ModalHeader>
<ModalBody>
<DragDropContext onDragEnd={moveArrayItem}>
<FormBody>
Expand Down

0 comments on commit 258d190

Please sign in to comment.