mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-11-04 06:05:04 +00:00
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:
1 file changed
+1
-1
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user