From 7296a2c51899b284dca2863732d0d0a4b404b411 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Fri, 14 Jan 2022 11:38:08 -0500 Subject: [PATCH] fixed annoying bug where the trigger disappears when you edit --- webapp/src/components/AutomationEditor/index.tsx | 2 +- webapp/src/components/AutomationList/index.tsx | 3 --- webapp/src/components/SequenceNodes/index.tsx | 2 +- webapp/src/components/SequenceNodes/types.ts | 2 +- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/webapp/src/components/AutomationEditor/index.tsx b/webapp/src/components/AutomationEditor/index.tsx index d817c2c..849d38a 100644 --- a/webapp/src/components/AutomationEditor/index.tsx +++ b/webapp/src/components/AutomationEditor/index.tsx @@ -75,7 +75,7 @@ export const AutomationEditor: FC = ({ dims={dims} sequence={automation.sequence} onChange={updateSequence} - additionalElements={chain([ + additionalElements={() => chain([ computeExtraField([1, 0.5], [2, 0.5]), computeTriggerPos( [0.5, 0.5], diff --git a/webapp/src/components/AutomationList/index.tsx b/webapp/src/components/AutomationList/index.tsx index 07648b2..6dca8fd 100644 --- a/webapp/src/components/AutomationList/index.tsx +++ b/webapp/src/components/AutomationList/index.tsx @@ -27,12 +27,9 @@ export const AutomationList: FC = ({ children, }) => { // state - // const [searchParams, setSearchParams] = useSearchParams(); const [hideList, setHideList] = useState(false); const [current, setCurrent] = useState(0); // alias - // const current = Number(searchParams.get("current") ?? "0"); - // const setCurrent = (i: number) => setSearchParams({ current: String(i) }); const currentAuto = automations.length > 0 ? automations[current] : null; const automationListListCls = "automation-list--list" + (hideList ? " hide" : " show") // render diff --git a/webapp/src/components/SequenceNodes/index.tsx b/webapp/src/components/SequenceNodes/index.tsx index 5646519..8b32754 100644 --- a/webapp/src/components/SequenceNodes/index.tsx +++ b/webapp/src/components/SequenceNodes/index.tsx @@ -60,7 +60,7 @@ export const SequenceNodes: FC = (pro s => setModalState(s) ); if (props.additionalElements) { - elmIter = chain([elmIter, props.additionalElements]); + elmIter = chain([elmIter, props.additionalElements()]); } // render diff --git a/webapp/src/components/SequenceNodes/types.ts b/webapp/src/components/SequenceNodes/types.ts index dc477f3..b6f9d46 100644 --- a/webapp/src/components/SequenceNodes/types.ts +++ b/webapp/src/components/SequenceNodes/types.ts @@ -11,7 +11,7 @@ export interface SequenceNodeProps { dims: DAGBoardElmDims; sequence: AutomationSequenceNode[], onChange: (s: AutomationSequenceNode[]) => void; - additionalElements?: Generator; + additionalElements?: () => Generator; } export type ModalState = {