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

fix(useLoader): make better use of generics for extensions #2598

Merged
merged 3 commits into from Oct 29, 2022

Conversation

CodyJasonBennett
Copy link
Member

@CodyJasonBennett CodyJasonBennett commented Oct 28, 2022

Fixes #2579 by inferring the loader prototype and passing it to extensions.

import { useLoader } from '@react-three/fiber'
import { MTLLoader, OBJLoader } from 'three-stdlib'

const materials = useLoader(MTLLoader, '/path/to/materials.mtl')
const object = useLoader(OBJLoader, '/path/to/geometry.obj', (loader) => {
  materials.preload()
  loader.setMaterials(materials)
})

@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 28, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit a9e6db6:

Sandbox Source
example Configuration

@CodyJasonBennett
Copy link
Member Author

Will need to evaluate upstream effects in Drei before merging.

@CodyJasonBennett CodyJasonBennett merged commit 84f567c into master Oct 29, 2022
@CodyJasonBennett CodyJasonBennett deleted the fix/useLoader-generics branch October 29, 2022 11:29
@CodyJasonBennett CodyJasonBennett removed the request for review from joshuaellis October 29, 2022 11:35
renovate bot added a commit to ziyadedher/ziyadedher that referenced this pull request Oct 29, 2022
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@react-three/fiber](https://togithub.com/pmndrs/react-three-fiber) |
[`8.8.10` ->
`8.9.0`](https://renovatebot.com/diffs/npm/@react-three%2ffiber/8.8.10/8.9.0)
|
[![age](https://badges.renovateapi.com/packages/npm/@react-three%2ffiber/8.9.0/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/npm/@react-three%2ffiber/8.9.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/npm/@react-three%2ffiber/8.9.0/compatibility-slim/8.8.10)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/npm/@react-three%2ffiber/8.9.0/confidence-slim/8.8.10)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>pmndrs/react-three-fiber</summary>

###
[`v8.9.0`](https://togithub.com/pmndrs/react-three-fiber/releases/tag/v8.9.0)

[Compare
Source](https://togithub.com/pmndrs/react-three-fiber/compare/v8.8.11...v8.9.0)

##### What's Changed

- fix(loop): export flush methods and types by
[@&#8203;CodyJasonBennett](https://togithub.com/CodyJasonBennett) in
[pmndrs/react-three-fiber#2580

Re-release of
[#&#8203;2481](https://togithub.com/pmndrs/react-three-fiber/issues/2481)
from
[`v8.7.0`](https://togithub.com/pmndrs/react-three-fiber/releases/tag/v8.7.0),
it just didn't get exported.

**Full Changelog**:
pmndrs/react-three-fiber@v8.8.11...v8.9.0

###
[`v8.8.11`](https://togithub.com/pmndrs/react-three-fiber/releases/tag/v8.8.11)

[Compare
Source](https://togithub.com/pmndrs/react-three-fiber/compare/v8.8.10...v8.8.11)

#### What's Changed

- docs(links): Add Threejs Journey link to recommended documentation by
[@&#8203;Ahlecss](https://togithub.com/Ahlecss) in
[pmndrs/react-three-fiber#2592
- fix: pointer events and pointer capture by
[@&#8203;adventful](https://togithub.com/adventful) in
[pmndrs/react-three-fiber#2600
- fix(events): sort by distance on undefined roots by
[@&#8203;Inuniku](https://togithub.com/Inuniku) in
[pmndrs/react-three-fiber#2599
- fix(useLoader): make better use of generics for extensions by
[@&#8203;CodyJasonBennett](https://togithub.com/CodyJasonBennett) in
[pmndrs/react-three-fiber#2598

#### New Contributors

- [@&#8203;Ahlecss](https://togithub.com/Ahlecss) made their first
contribution in
[pmndrs/react-three-fiber#2592
- [@&#8203;adventful](https://togithub.com/adventful) made their first
contribution in
[pmndrs/react-three-fiber#2600

**Full Changelog**:
pmndrs/react-three-fiber@v8.8.10...v8.8.11

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click
this checkbox.

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/ziyadedher/ziyadedher).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC42LjEiLCJ1cGRhdGVkSW5WZXIiOiIzNC42LjEifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
ziyadedher pushed a commit to ziyadedher/ziyadedher that referenced this pull request Dec 16, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@react-three/fiber](https://togithub.com/pmndrs/react-three-fiber) |
[`8.8.10` ->
`8.9.0`](https://renovatebot.com/diffs/npm/@react-three%2ffiber/8.8.10/8.9.0)
|
[![age](https://badges.renovateapi.com/packages/npm/@react-three%2ffiber/8.9.0/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/npm/@react-three%2ffiber/8.9.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/npm/@react-three%2ffiber/8.9.0/compatibility-slim/8.8.10)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/npm/@react-three%2ffiber/8.9.0/confidence-slim/8.8.10)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>pmndrs/react-three-fiber</summary>

###
[`v8.9.0`](https://togithub.com/pmndrs/react-three-fiber/releases/tag/v8.9.0)

[Compare
Source](https://togithub.com/pmndrs/react-three-fiber/compare/v8.8.11...v8.9.0)

##### What's Changed

- fix(loop): export flush methods and types by
[@&#8203;CodyJasonBennett](https://togithub.com/CodyJasonBennett) in
[pmndrs/react-three-fiber#2580

Re-release of
[#&#8203;2481](https://togithub.com/pmndrs/react-three-fiber/issues/2481)
from
[`v8.7.0`](https://togithub.com/pmndrs/react-three-fiber/releases/tag/v8.7.0),
it just didn't get exported.

**Full Changelog**:
pmndrs/react-three-fiber@v8.8.11...v8.9.0

###
[`v8.8.11`](https://togithub.com/pmndrs/react-three-fiber/releases/tag/v8.8.11)

[Compare
Source](https://togithub.com/pmndrs/react-three-fiber/compare/v8.8.10...v8.8.11)

#### What's Changed

- docs(links): Add Threejs Journey link to recommended documentation by
[@&#8203;Ahlecss](https://togithub.com/Ahlecss) in
[pmndrs/react-three-fiber#2592
- fix: pointer events and pointer capture by
[@&#8203;adventful](https://togithub.com/adventful) in
[pmndrs/react-three-fiber#2600
- fix(events): sort by distance on undefined roots by
[@&#8203;Inuniku](https://togithub.com/Inuniku) in
[pmndrs/react-three-fiber#2599
- fix(useLoader): make better use of generics for extensions by
[@&#8203;CodyJasonBennett](https://togithub.com/CodyJasonBennett) in
[pmndrs/react-three-fiber#2598

#### New Contributors

- [@&#8203;Ahlecss](https://togithub.com/Ahlecss) made their first
contribution in
[pmndrs/react-three-fiber#2592
- [@&#8203;adventful](https://togithub.com/adventful) made their first
contribution in
[pmndrs/react-three-fiber#2600

**Full Changelog**:
pmndrs/react-three-fiber@v8.8.10...v8.8.11

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click
this checkbox.

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/ziyadedher/ziyadedher).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC42LjEiLCJ1cGRhdGVkSW5WZXIiOiIzNC42LjEifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Property 'setMaterials' does not exist on type 'Loader' when using useLoader extensions
1 participant