diff --git a/src/components/Epochs.js b/src/components/Epochs.js index 8a37255..90eddf5 100644 --- a/src/components/Epochs.js +++ b/src/components/Epochs.js @@ -25,11 +25,14 @@ const Epochs = props => { } const updateEpoch = (epoch, epochIndex) => { - let updatedEpochs = [...props.epochs] - updatedEpochs[epochIndex] = epoch + const dispatchValue = { + name: epoch.name, + index: epochIndex, + changes: epoch.changes + } props.dispatch({ type: "SET_EPOCH", - value: epoch + value: dispatchValue }) } diff --git a/src/components/SoundChangeSuite.js b/src/components/SoundChangeSuite.js index 59abeef..eb0b6e5 100644 --- a/src/components/SoundChangeSuite.js +++ b/src/components/SoundChangeSuite.js @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import './SoundChangeSuite.scss'; const SoundChangeSuite = props => { @@ -8,6 +8,10 @@ const SoundChangeSuite = props => { cb(e); props.updateEpoch(epoch, props.epochIndex); } + + useEffect(() => { + props.updateEpoch(epoch, props.epochIndex); + }, [epoch]) return (