Skip to content

fix(nui): use correct queue key for frameCall messages#3853

Open
gtolontop wants to merge 2 commits intocitizenfx:masterfrom
gtolontop:fix/nui-frame-message-queue
Open

fix(nui): use correct queue key for frameCall messages#3853
gtolontop wants to merge 2 commits intocitizenfx:masterfrom
gtolontop:fix/nui-frame-message-queue

Conversation

@gtolontop
Copy link
Copy Markdown
Contributor

Goal of this PR

Fix NUI messages being silently lost when sent before the UI has finished loading. The message queue was using the wrong key for frameCall messages, causing TriggerLoadEnd to never find and flush them.

How is this PR achieving the goal

The g_processMessageQueue uses frame names as keys, and TriggerLoadEnd flushes queued messages by frame name. However, the original code used argumentList->GetString(0) as the queue key for all non-rootCall messages — this is the message type (e.g. "frameCall"), not the frame name.

For frameCall messages created via PostJSEvent("frameCall", { frame, jsonData }), the frame name is at index 1, not index 0. The fix correctly extracts the frame name from the argument list based on the message type:

  • frameCall: uses argumentList->GetString(1) (the frame name)
  • rootCall: uses "__root"
  • Other types: uses argumentList->GetString(0) (unchanged behavior)

This PR applies to the following area(s)

FiveM and RedM NUI core (nui-core)

Successfully tested on

  • Verified that frameCall messages sent before UI load are correctly queued under the frame name and flushed by TriggerLoadEnd
  • Verified that rootCall messages continue to queue under "__root" as before
  • No regression in normal message delivery when the browser is already loaded

Checklist

  • Code compiles and has been tested successfully.
  • Code explains itself well and/or is documented.
  • My commit message explains what the changes do and what they are for.
  • No extra compilation warnings are added by these changes.

Fixes issues

Fixes #3847

The message queue used argumentList->GetString(0) (the message type)
as the queue key for all non-rootCall messages. Since TriggerLoadEnd
flushes by frame name, frameCall messages were never dequeued, causing
early NUI messages to be silently lost.
@github-actions github-actions bot added triage Needs a preliminary assessment to determine the urgency and required action invalid Requires changes before it's considered valid and can be (re)triaged and removed triage Needs a preliminary assessment to determine the urgency and required action labels Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

invalid Requires changes before it's considered valid and can be (re)triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

In some cases, the UI loads very slowly.

1 participant