Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/component/modals/OptionsModal.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useEffect, useState } from 'react';
import ParentModal from './ParentModal';
import { actionType as T } from '../../reducer';
import './optionsModal.css';
Expand All @@ -10,6 +10,25 @@ const OptionsModal = ({ superState, dispatcher }) => {
const [param, setParam] = useState('');
const [maxT, setmaxT] = useState('');
const [library, setLibrary] = useState('');

useEffect(() => {
if (!superState.optionsModal) return;
setUnlock(Boolean(superState.unlockCheck));
setDocker(Boolean(superState.dockerCheck));
setOctave(Boolean(superState.octave));
setParam(superState.params || '');
setmaxT(superState.maxTime || '');
setLibrary(superState.library || '');
}, [
superState.optionsModal,
superState.unlockCheck,
superState.dockerCheck,
superState.octave,
superState.params,
superState.maxTime,
superState.library,
]);

const close = () => {
dispatcher({ type: T.SET_OPTIONS_MODAL, payload: false });
dispatcher(
Expand Down