fix(web/menu): move firstRengerRef check earlier in the function (#145)

* This fixes a case where, if the first option selected in a menu doesn't have side scroll values, the first time that you *did* side scroll on an item in that menu it would no trigger onSideScroll
This commit is contained in:
Jag
2022-10-29 01:11:40 -07:00
committed by GitHub
parent e840bbb50f
commit de23227ea7

View File

@@ -87,11 +87,11 @@ const ListMenu: React.FC = () => {
};
useEffect(() => {
if (!menu.items[selected]?.values) return;
if (firstRenderRef.current) {
firstRenderRef.current = false;
return;
}
if (!menu.items[selected]?.values) return;
const timer = setTimeout(() => {
fetchNui('changeIndex', [selected, indexStates[selected]]).catch();
}, 100);