qbcore-framework / qb-inventory

Slot Based Inventory System Used With QB-Core :school_satchel:
GNU General Public License v3.0
50 stars 377 forks source link

[BUG] No cursor in inventory #369

Closed Jorn08 closed 1 year ago

Jorn08 commented 1 year ago

Summary

Sometimes when opening an inventory the NUI focus is lost, having no cursor while the inventory is visible.

Reproduction

Using the txAdminRecipe 2.2.4

Enter the default qb-traphouse. Use the 'Take Over ($5000)'. Then press View Inventory.

Expected behavior

Expected the inventory to have NUI focus.

Actual behavior

The inventory does not have NUI focus.

Additional context

Pressing 'View Inventory' triggers qb-traphouse:client:target:ViewInventory, which in turn triggers inventory:server:OpenInventory. This server event triggers the following two client events

TriggerClientEvent("qb-inventory:client:closeinv", id)
TriggerClientEvent("inventory:client:OpenInventory", src, {}, Player.PlayerData.items, secondInv)

To these client events I have added logs to track the flow.

image

As you can see the events as well as the js code they are calling are handled in the order they are executed, qb-inventory:client:closeinv first then inventory:client:OpenInventory. Except the Inventory.Close javascript functions calls the callback https://qb-inventory/CloseInventory which executes after the inventory had already opened. This causes a race condition.

This bug was introduced two months ago by this commit.

Last Updated

Yesterday

Custom Resources

No

Resource Rename

No

TheMaf021 commented 1 year ago

This is what worked for me:

Traphouse is now working for me.

tom-osborne commented 1 year ago

This was fixed for qb-traphouse in https://github.com/qbcore-framework/qb-traphouse/pull/45