Skip to content

Instantly share code, notes, and snippets.

@jctanner
Created August 10, 2020 13:40
Show Gist options
  • Save jctanner/048d59721c3c229d12a2edff8fbc701a to your computer and use it in GitHub Desktop.
Save jctanner/048d59721c3c229d12a2edff8fbc701a to your computer and use it in GitHub Desktop.
diff --git a/src/Containers/AutomationCalculator/AutomationCalculator.js b/src/Containers/AutomationCalculator/AutomationCalculator.js
index 9dff49a..960f9a5 100644
--- a/src/Containers/AutomationCalculator/AutomationCalculator.js
+++ b/src/Containers/AutomationCalculator/AutomationCalculator.js
@@ -275,12 +275,16 @@ export const useAutomationFormula = () => {
const [ totalSavings, setTotalSavings ] = useState(0);
const [ unfilteredData, setUnfilteredData ] = useState([]);
const [ formattedData, setFormattedData ] = useState([]);
+ const [ mangledData, setMangledData ] = useState([]);
const [ templatesList, setTemplatesList ] = useState([]);
const [ roiData, setRoiData ] = useState([]);
const [ selectedIds, setSelectedIds ] = useState([]);
const { formatData } = automationCalculatorMethods();
+ useEffect(() => {
+ }, [ mangledData ]);
+
useEffect(() => {
let data = [ ...formattedData ];
let total = 0;
@@ -304,6 +308,9 @@ export const useAutomationFormula = () => {
.toString()
.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
setTotalSavings('$' + totalWithCommas);
+
+ setMangledData([ ...data ]);
+
}, [ formattedData, costAutomation, costManual ]);
useEffect(() => {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment