Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled error when passing table metadata to displayMetadata func #1873

Open
NikartikTheBear opened this issue Jan 18, 2025 · 2 comments
Open
Labels
bug Something isn't working

Comments

@NikartikTheBear
Copy link

NikartikTheBear commented Jan 18, 2025

Describe the bug
An unhandled error when passing metadata tables to the show metadata function. This breaks the inventory and prevents further usage breaking the ui, the resource must be reloaded to restore.

Framework
ESX

Resource version
2.43.3

To Reproduce
Steps to reproduce the behavior:

  • Create an item with a table metadata property
  • Call the displayMetadata function with that property

Expected behavior
A warning/error should be issued without breaking inventory functionality

Screenshots
Throws an Uncaught Minified react error 31

Additional context
I know that table metadata may not be displayed due to how it's handled but i guess an error should be thrown to avoid breaking functionality

@NikartikTheBear NikartikTheBear added the bug Something isn't working label Jan 18, 2025
@tom-osborne
Copy link
Member

Create an item with a table metadata property

@NikartikTheBear Could you provide some example code for the item you are experiencing this issue with please?

@NikartikTheBear
Copy link
Author

Create an item with a table metadata property

@NikartikTheBear Could you provide some example code for the item you are experiencing this issue with please?

I Apologize for the poor explanation i will try to be a bit more precise.

Firstly i create an item with some metadata property:

RegisterCommand("testitem", function(s)
    exports.ox_inventory:AddItem(s, "wool",1, {
        label = "MyWOOL",
        meta1 = "metadata",
        tableMeta = {
            key = "value"
        }
    })
end, false)

I then proceed to display the metadata:

  exports.ox_inventory:displayMetadata({
    meta1 = "Name",
    tableMeta = "Table"
  })

The inventory works just fine on opening:

Image

But open hovering on the created item you get this:

Image
forcing the resource reload. By removing the table metadata form the display fucuntion it works just fine

Image

I'm aware you should just send to display a kv table or array like table but i thought it was weird there was such a disruptive error not handled

This is most probably a knowledge lacking on my part and in such case i truly apologize if this is useless and a waste of time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants