Skip to content

Commit

Permalink
feat: import raw changes to view mode
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulFarault committed Mar 8, 2023
1 parent 3a2d38c commit 5b09b63
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/Services/VariablesDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
useFieldArray,
} from 'react-hook-form'
import Editor from '@monaco-editor/react'
import { merge } from 'mixme'
import { Bars3CenterLeftIcon, EyeIcon } from '@heroicons/react/24/solid'
import { Disclosure, Sidebar } from 'src/components/Layout'
import { Button, IconButon } from 'src/components/commons'
Expand Down Expand Up @@ -59,7 +60,7 @@ function flattenObject(obj: Object) {
function ServiceVariables({ variables }: { variables: Object }) {
const { currentServiceId, currentComponentId } = useParamsContext()
const dispatch = useAppDispatch()
const { getValues, control } = useFormContext()
const { getValues, control, reset } = useFormContext()
const { dirtyFields } = useFormState({ control })
const editorRef = useRef(null)
const {
Expand Down Expand Up @@ -98,6 +99,7 @@ function ServiceVariables({ variables }: { variables: Object }) {
if (currentServiceId && !currentComponentId) {
dispatch(setServiceVariables(dirtyValues))
}
reset(merge(variables, dirtyValues))
}

return (
Expand Down

0 comments on commit 5b09b63

Please sign in to comment.