diff --git a/web/src/components/EditPartCell/EditPartCell.js b/web/src/components/EditPartCell/EditPartCell.js
index 3ba7344..b434a62 100644
--- a/web/src/components/EditPartCell/EditPartCell.js
+++ b/web/src/components/EditPartCell/EditPartCell.js
@@ -1,5 +1,4 @@
-import { useMutation, useFlash } from '@redwoodjs/web'
-import { navigate, routes } from '@redwoodjs/router'
+import { useMutation } from '@redwoodjs/web'
import PartForm from 'src/components/PartForm'
export const QUERY = gql`
@@ -26,17 +25,9 @@ const UPDATE_PART_MUTATION = gql`
export const Loading = () =>
Loading...
export const Success = ({ part }) => {
- const { addMessage } = useFlash()
- const [updatePart, { loading, error }] = useMutation(UPDATE_PART_MUTATION, {
- onCompleted: () => {
- navigate(routes.parts())
- addMessage('Part updated.', { classes: 'rw-flash-success' })
- },
- })
+ const [updatePart, { loading, error }] = useMutation(UPDATE_PART_MUTATION)
- const onSave = (input, id) => {
- updatePart({ variables: { id, input } })
- }
+ const onSave = (input, id) => updatePart({ variables: { id, input } })
return (
diff --git a/web/src/components/PartForm/PartForm.js b/web/src/components/PartForm/PartForm.js
index 64d8fbb..c300d8c 100644
--- a/web/src/components/PartForm/PartForm.js
+++ b/web/src/components/PartForm/PartForm.js
@@ -8,16 +8,27 @@ import {
Submit,
} from '@redwoodjs/forms'
import { useState } from 'react';
+import { navigate, routes } from '@redwoodjs/router'
+import { useFlash } from '@redwoodjs/web'
import Editor from "rich-markdown-editor";
const PartForm = (props) => {
+ const { addMessage } = useFlash()
const [description, setDescription] = useState(props?.part?.description)
- const onSubmit = (data) => {
- props.onSave({
+ const onSubmit = async (data, e) => {
+
+ await props.onSave({
...data,
description,
}, props?.part?.id)
+ const shouldOpenIde = e?.nativeEvent?.submitter?.dataset?.openIde
+ if(shouldOpenIde) {
+ navigate(routes.partIde({id: props?.part?.id}))
+ } else {
+ navigate(routes.part({id: props?.part?.id}))
+ }
+ addMessage('Part updated.', { classes: 'rw-flash-success' })
}
return (
@@ -80,6 +91,9 @@ const PartForm = (props) => {
Save
+
+ Save and open IDE
+