Skip to content

fix(server): keep a deferral card on screen while other resources update - #4399

Open
OneEarJoe5 wants to merge 1 commit into
citizenfx:masterfrom
OneEarJoe5:fix/deferral-card-progress
Open

OneEarJoe5 wants to merge 1 commit into
citizenfx:masterfrom
OneEarJoe5:fix/deferral-card-progress

Conversation

@OneEarJoe5

Copy link
Copy Markdown

Goal of this PR

A card shown with deferrals.presentCard(card, cb) gets replaced by the progress text as soon as any other resource calls deferrals.update(). The card never comes back, so the player can't submit it and the resource waits on a callback that can't fire. Common on servers where several resources defer in playerConnecting (framework, inventory, queue, name checks...).

How is this PR achieving the goal

ClientDeferral now remembers which resource has a card that's still waiting for a response. While there is one, UpdateDeferrals doesn't send the progress message to the client. It's released when:

  • the player submits the card,
  • the same resource calls update(), done() or presents another card,

and rejections and the final resolve go through like before. Cards without a callback don't hold anything back, so status-only cards (queues etc.) behave the same as now.

Server side only, the client doesn't change.

This PR applies to the following area(s)

Server

Successfully tested on

Game builds: 3889

Platforms: Windows

Repro: one resource shows a card with an Input.Text and a submit callback, a second resource keeps calling deferrals.update() every second for a few seconds and then done().

  • Before: card disappears on the first update, the callback never fires, the connection hangs until the resource gives up.
  • After: card stays, progress from the other resource doesn't show, submit reaches the callback and the player joins. Submitting while the other resource is still updating works too, its progress shows again right after.

Other cases I checked with the fix:

  • another resource rejects (done("reason")) while the card is open: the rejection shows right away
  • card without a callback: gets replaced by the other resource's progress like before
  • the card resource calls update() itself after the answer: card goes away, both resources' progress lines show
  • no card at all: progress messages and joining work like before

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 #4397

When a resource shows an adaptive card with a submit callback during
playerConnecting, any deferrals.update() from another resource sends the
combined progress text to the client, which replaces the card. Nothing
shows the card again, so the player can't answer it and the resource
waits forever.

Hold back progress messages while a card is waiting for its response.
The card resource replacing it (update, done, a new card), the player
submitting it, or a rejection still go through as before. Cards without
a callback don't hold anything back.

Signed-off-by: OneEarJoe5 <212275319+OneEarJoe5@users.noreply.github.com>
@github-actions github-actions Bot added the invalid Requires changes before it's considered valid and can be (re)triaged label Nov 13, 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.

Adaptive card not working? Question

1 participant