Skip to content

fix(esx_multicharacter): Await nuiReady before setting up characters#1661

Merged
Kenshiin13 merged 2 commits into
esx-framework:devfrom
Zykem:feat/nuiready-await
Jul 13, 2025
Merged

fix(esx_multicharacter): Await nuiReady before setting up characters#1661
Kenshiin13 merged 2 commits into
esx-framework:devfrom
Zykem:feat/nuiready-await

Conversation

@Zykem

@Zykem Zykem commented Jul 6, 2025

Copy link
Copy Markdown
Member

Description

This PR fixes an issue where players would sometimes be stuck with no UI during character selection, especially on slower systems. The root cause is the ToggleMulticharacter event being sent before the NUI is fully loaded. To fix this, we now send a nuiReady event from the React app as soon as it mounts, letting the Lua side know it's safe to proceed.


Motivation

On slower computers, the frontend may not be ready by the time the ToggleMulticharacter event is triggered, causing the UI to either not show up at all or behave incorrectly. This is a frustrating experience during character selection. By waiting for an explicit nuiReady signal from the NUI, we can avoid these race conditions and ensure the UI only shows when it’s actually ready.


Implementation Details

  • Added a useEffect in App.tsx that dispatches a nuiReady event when the React app mounts.
  • Lua should now listen for nuiReady before sending any data or showing the UI.
  • This ensures that character selection only starts once the frontend is fully initialized.

Usage Example


PR Checklist

  • [1] My commit messages and PR title follow the Conventional Commits standard.
  • [1] My changes have been tested locally and function as expected.
  • [1] My PR does not introduce any breaking changes.
  • [1] I have provided a clear explanation of what my PR does, including the reasoning behind the changes and any relevant context.

@github-project-automation github-project-automation Bot moved this to 🆕 To be Discussed in ESX Roadmap Jul 6, 2025

@Kenshiin13 Kenshiin13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@github-project-automation github-project-automation Bot moved this from 🆕 To be Discussed to Ready for Next Update in ESX Roadmap Jul 13, 2025
@Kenshiin13 Kenshiin13 merged commit 84f10fd into esx-framework:dev Jul 13, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for Next Update

Development

Successfully merging this pull request may close these issues.

3 participants