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

useTexture(..., onLoad) callback receives incorrect values #1969

Closed
jwueller opened this issue May 30, 2024 · 3 comments · May be fixed by #2142
Closed

useTexture(..., onLoad) callback receives incorrect values #1969

jwueller opened this issue May 30, 2024 · 3 comments · May be fixed by #2142
Labels
bug Something isn't working Stale Inactive issue

Comments

@jwueller
Copy link

  • three version: 0.164.1
  • @react-three/fiber version: 8.16.6
  • @react-three/drei version: 9.105.6
  • node version: v22.2.0
  • npm (or yarn) version: 1.22.22

Problem description:

The types declare that the callback receives the same type that's returned from the hook itself. However, that's not the case, and it will never receive a record object.

Relevant code:

const returnedTextures = useTexture(
    {map: 'color.jpg', normalMap: 'normal.png'},
    (callbackTextures) => {
        // callbackTextures can never be an object here, and always produces and
        // array, as opposed to returnedTextures, which correctly adheres to the
        // declared type.
    },
);

Suggested solution:

Fix the callback to adhere to the declared type. I will provide a PR for this.

@jwueller jwueller added the bug Something isn't working label May 30, 2024
@jwueller jwueller changed the title useTexture(..., onLoad callback receives incorrect values useTexture(..., onLoad) callback receives incorrect values May 30, 2024
jwueller added a commit to jwueller/drei that referenced this issue May 30, 2024
@zaesur
Copy link

zaesur commented Sep 19, 2024

Just a heads up that I'm experiencing the same issue.

Is there anything blocking review of this PR?

Copy link

Thank you for contributing! We’re marking this issue as stale as a gentle reminder to revisit it and give it the attention it needs to move forward.

Any activity, like adding an update or comment, will automatically remove the stale label so it stays on our radar.

Feel free to reach out on Discord if you need support or feedback from the community. This issue will close automatically soon if there’s no further activity. Thank you for understanding and for being part of the project!

@github-actions github-actions bot added the Stale Inactive issue label Nov 18, 2024
Copy link

We’re closing this issue to keep our project manageable and make room for other active work, but we truly appreciate your effort and contribution.

If you’d like to continue working on this, please feel free to re-open it or reach out on Discord — our community is always ready to support you. Thanks again for helping us stay organized and for understanding our approach!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Stale Inactive issue
Projects
None yet
2 participants