diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx index 66f8425ffc..8fde8ef885 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx @@ -5,7 +5,7 @@ import './styles/assembly-items.css' export const AssemblyItems = ({ registerEvent }) => { const [assemblyItems, dispatch] = useReducer(reducer, initialState) const [selectedItem, setSelectedItem] = useState(0) - const [scrollHeight, setScrollHeight] = useState(null) + // const [index, setIndex] = useState(assemblyItems.opCodes.index) const refs = useRef({}) const asmItemsRef = useRef(null) @@ -16,16 +16,10 @@ export const AssemblyItems = ({ registerEvent }) => { }, []) useEffect(() => { - indexChanged(assemblyItems.index) - }, [assemblyItems.index]) - - useEffect(() => { - if (asmItemsRef.current.scrollTop > scrollHeight) { - console.log('scrolling up') - } else if (asmItemsRef.current.scrollTop < scrollHeight) { - console.log('scrolling down') + if (selectedItem !== assemblyItems.index) { + indexChanged(assemblyItems.index) } - }, [asmItemsRef.current.scrollTop]) + }, [assemblyItems.index]) const indexChanged = (index: number) => { if (index < 0) return @@ -47,18 +41,21 @@ export const AssemblyItems = ({ registerEvent }) => { setSelectedItem(index) } } + + // const handleScroll = () => { + // const codeView = asmItemsRef.current - const onScroll = () => { - - } - - + // if (codeView.scrollTop === 0) { + // dispatch({ type: 'FETCH_PREV_OPCODES', payload: {} }) + // codeView.scrollTop = 0 + // } + // } return (