From b926a5fee39f0a188f2425ef0458329af889a4e2 Mon Sep 17 00:00:00 2001 From: macabeus Date: Fri, 7 Jun 2019 23:19:31 -0300 Subject: [PATCH] select-vision: fix state when none vision is selected --- brush/src/components/SelectVision/index.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/brush/src/components/SelectVision/index.js b/brush/src/components/SelectVision/index.js index 4faf8b4..02e9fad 100644 --- a/brush/src/components/SelectVision/index.js +++ b/brush/src/components/SelectVision/index.js @@ -5,7 +5,12 @@ import ROMContext from '../../context/ROMContext' const SelectVision = () => { const { romBufferMemory } = useContext(ROMContext) - const { updateVision, visionIndex, visionWorld } = useContext(VisionContext) + const { + updateVision, + vision: { state: visionState }, + visionIndex, + visionWorld, + } = useContext(VisionContext) const setNewVision = (newVision) => { const [newVisionWorld, newVisionIndex] = newVision.split('-') @@ -13,11 +18,16 @@ const SelectVision = () => { updateVision(romBufferMemory, newVisionWorld, newVisionIndex) } + const dropdownValue = visionState === 'noSelected' ? + '' : + `${visionWorld}-${visionIndex}` + return ( setNewVision(e.target.value)} - value={`${visionWorld}-${visionIndex}`} + value={dropdownValue} options={[{ name: 'Vision 1-1', value: '1-1' }, { name: 'Vision 1-2', value: '1-2' }]} /> )