Skip to content

Commit 755ef7d

Browse files
gregfromstljoaquim-verges
authored andcommitted
update
1 parent 8c28a24 commit 755ef7d

File tree

28 files changed

+367
-971
lines changed

28 files changed

+367
-971
lines changed

.changeset/tall-pots-live.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,35 @@
22
"thirdweb": minor
33
---
44

5-
NFT component provider changed from NFT to NFT.Provider
5+
# Breaking change
6+
We are making the following changes to the NFT component to provide better performance and fine-grain control over their internal fetching logic.
7+
Moreover, you no longer have to wrap React.Suspense around said components!
68

9+
### Old
710
```tsx
8-
<NFT.Provider contract={contract} tokenId={0n}>
9-
<Suspense fallback={"Loading nft..."}>
11+
<NFT>
12+
<React.Suspense fallback={"Loading stuff..."}>
1013
<NFT.Media />
14+
<NFT.Name />
1115
<NFT.Description />
12-
</Suspense>
16+
</React.Suspense>
17+
</NFT>
18+
```
19+
20+
### New
21+
The new version comes with 2 new props: `loadingComponent` and `fallbackComponent`.
22+
Basically, `loadingComponent` takes in a component and show it _while the internal fetching is being done_
23+
`fallbackComponent` takes in a component and show it _once the data is failed to be resolved_
24+
25+
```tsx
26+
<NFTProvider contract={contract} tokenId={0n}>
27+
<NFTMedia
28+
loadingComponent={<span>Loading NFT Image</span>}
29+
fallbackComponent={<span>Failed to load NFT</span>}
30+
/>
31+
<NFT.Description
32+
loadingComponent={<span>Loading NFT Description</span>}
33+
fallbackComponent={<span>Failed to load NFT Description</span>}
34+
/>
1335
</NFT>
1436
```

apps/portal/src/app/react/v5/sidebar.tsx

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -320,13 +320,29 @@ export const sidebar: SideBar = {
320320
links: [
321321
{
322322
name: "UI Components",
323-
links: ["ClaimButton", "TransactionButton", "MediaRenderer"].map(
324-
(name) => ({
325-
name,
326-
href: `${slug}/${name}`,
327-
icon: <CodeIcon />,
328-
}),
329-
),
323+
links: [
324+
...["ClaimButton", "TransactionButton", "MediaRenderer"].map(
325+
(name) => ({
326+
name,
327+
href: `${slug}/${name}`,
328+
icon: <CodeIcon />,
329+
}),
330+
),
331+
{
332+
name: "NFT",
333+
isCollapsible: true,
334+
links: [
335+
"NFTProvider",
336+
"NFTMedia",
337+
"NFTName",
338+
"NFTDescription",
339+
].map((name) => ({
340+
name,
341+
href: `${slug}/${name}`,
342+
icon: <CodeIcon />,
343+
})),
344+
},
345+
],
330346
},
331347
{
332348
name: "Reading State",

packages/thirdweb/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@
10411041

10421042
<NFT contract={contract} tokenId={0n}>
10431043
<Suspense fallback={"Loading media..."}>
1044-
<NFT.Media />
1044+
<NFTMedia />
10451045
</Suspense>
10461046
</NFT>;
10471047
```

packages/thirdweb/src/exports/react.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,22 @@ export {
174174
} from "../react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.js";
175175

176176
// NFT rendering components
177-
export * as NFT from "../react/web/ui/prebuilt/NFT/index.js";
177+
export {
178+
NFTProvider,
179+
type NFTProviderProps,
180+
} from "../react/web/ui/prebuilt/NFT/provider.js";
181+
export {
182+
NFTName,
183+
type NFTNameProps,
184+
} from "../react/web/ui/prebuilt/NFT/name.js";
185+
export {
186+
NFTDescription,
187+
type NFTDescriptionProps,
188+
} from "../react/web/ui/prebuilt/NFT/description.js";
189+
export {
190+
NFTMedia,
191+
type NFTMediaProps,
192+
} from "../react/web/ui/prebuilt/NFT/media.js";
178193

179194
export { useConnectionManager } from "../react/core/providers/connection-manager.js";
180195

packages/thirdweb/src/extensions/erc721/lazyMinting/read/getBatchesToReveal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export interface BatchToReveal {
2525
* @param options.contract {@link ThirdwebContract} - The NFT contract instance.
2626
* @returns A promise resolving to an array of unrevealed batches.
2727
*
28-
* @note Use the `batchId` and corresponding password for each batch to reveal it with `reveal`. {@see reveal}
28+
* Use the `batchId` and corresponding password for each batch to reveal it with `reveal`. {@see reveal}
2929
* @extension ERC721
3030
* @example
3131
* ```ts

packages/thirdweb/src/extensions/prebuilts/deploy-published.test.ts

Lines changed: 0 additions & 132 deletions
This file was deleted.

packages/thirdweb/src/react/core/hooks/wallets/useCapabilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { useActiveWallet } from "./useActiveWallet.js";
88
/**
99
* A hook to get the current wallet's capabilities according to [EIP-5792](https://eips.ethereum.org/EIPS/eip-5792).
1010
*
11-
* @note This function is dependent on the wallet's support for EIP-5792, but will not throw.
11+
* This function is dependent on the wallet's support for EIP-5792, but will not throw.
1212
* **The returned object contains a `message` field detailing any issues with the wallet's support for EIP-5792.**
1313
*
1414
* @returns a React Query object.

packages/thirdweb/src/react/core/hooks/wallets/useSendCalls.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import { useActiveWallet } from "./useActiveWallet.js";
2424
*
2525
* When calls are sent, all contracts that are interacted with will have their corresponding reads revalidated via React Query.
2626
*
27-
* @note This hook is dependent on the wallet's support for EIP-5792 and could fail.
28-
* @note The mutatuon function will use your currently connected wallet by default, but you can pass it a specific wallet to use if you'd like.
27+
* This hook is dependent on the wallet's support for EIP-5792 and could fail.
28+
* The mutatuon function will use your currently connected wallet by default, but you can pass it a specific wallet to use if you'd like.
2929
*
3030
* @returns A React Query mutatuon object to interact with {@link sendCalls}
3131
* @throws an error if the wallet does not support EIP-5792.
@@ -76,7 +76,7 @@ import { useActiveWallet } from "./useActiveWallet.js";
7676
* });
7777
* ```
7878
*
79-
* @note We recommend proxying any paymaster calls via an API route you setup and control.
79+
* We recommend proxying any paymaster calls via an API route you setup and control.
8080
* @extension EIP5792
8181
*/
8282
export function useSendCalls({

packages/thirdweb/src/react/native/hooks/wallets/useProfiles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { useAdminWallet } from "../../../core/hooks/wallets/useAdminWallet.js";
1010
* Retrieves all linked profiles of the connected in-app or ecosystem account.
1111
*
1212
* @returns A React Query result containing the linked profiles for the connected in-app account.
13-
* @note This hook will only run if the connected wallet supports account linking.
13+
* This hook will only run if the connected wallet supports account linking.
1414
*
1515
* @example
1616
* ```jsx

packages/thirdweb/src/react/web/hooks/wallets/useProfiles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { useAdminWallet } from "../../../core/hooks/wallets/useAdminWallet.js";
1010
* Retrieves all linked profiles of the connected in-app or ecosystem account.
1111
*
1212
* @returns A React Query result containing the linked profiles for the connected in-app account.
13-
* @note This hook will only run if the connected wallet supports account linking.
13+
* This hook will only run if the connected wallet supports account linking.
1414
*
1515
* @example
1616
* ```jsx

0 commit comments

Comments
 (0)