fix(nui): use correct queue key for frameCall messages#3853
Open
gtolontop wants to merge 2 commits intocitizenfx:masterfrom
Open
fix(nui): use correct queue key for frameCall messages#3853gtolontop wants to merge 2 commits intocitizenfx:masterfrom
gtolontop wants to merge 2 commits intocitizenfx:masterfrom
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
frameCallmessages, causingTriggerLoadEndto never find and flush them.How is this PR achieving the goal
The
g_processMessageQueueuses frame names as keys, andTriggerLoadEndflushes queued messages by frame name. However, the original code usedargumentList->GetString(0)as the queue key for all non-rootCallmessages — this is the message type (e.g."frameCall"), not the frame name.For
frameCallmessages created viaPostJSEvent("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: usesargumentList->GetString(1)(the frame name)rootCall: uses"__root"argumentList->GetString(0)(unchanged behavior)This PR applies to the following area(s)
FiveM and RedM NUI core (
nui-core)Successfully tested on
frameCallmessages sent before UI load are correctly queued under the frame name and flushed byTriggerLoadEndrootCallmessages continue to queue under"__root"as beforeChecklist
Fixes issues
Fixes #3847