Skip to content

Commit f6cbdb7

Browse files
authored
BREAKING: Removes 3D model support on MediaRenderer (#6443)
1 parent d350f8c commit f6cbdb7

File tree

5 files changed

+49
-147
lines changed

5 files changed

+49
-147
lines changed

.changeset/slow-mails-ring.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": minor
3+
---
4+
5+
BREAKING: Removes 3D model support in MediaRenderer

packages/thirdweb/package.json

Lines changed: 19 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -132,63 +132,25 @@
132132
},
133133
"typesVersions": {
134134
"*": {
135-
"adapters/*": [
136-
"./dist/types/exports/adapters/*.d.ts"
137-
],
138-
"auth": [
139-
"./dist/types/exports/auth.d.ts"
140-
],
141-
"chains": [
142-
"./dist/types/exports/chains.d.ts"
143-
],
144-
"contract": [
145-
"./dist/types/exports/contract.d.ts"
146-
],
147-
"deploys": [
148-
"./dist/types/exports/deploys.d.ts"
149-
],
150-
"event": [
151-
"./dist/types/exports/event.d.ts"
152-
],
153-
"extensions/*": [
154-
"./dist/types/exports/extensions/*.d.ts"
155-
],
156-
"pay": [
157-
"./dist/types/exports/pay.d.ts"
158-
],
159-
"react": [
160-
"./dist/types/exports/react.d.ts"
161-
],
162-
"react-native": [
163-
"./dist/types/exports/react-native.d.ts"
164-
],
165-
"rpc": [
166-
"./dist/types/exports/rpc.d.ts"
167-
],
168-
"storage": [
169-
"./dist/types/exports/storage.d.ts"
170-
],
171-
"transaction": [
172-
"./dist/types/exports/transaction.d.ts"
173-
],
174-
"utils": [
175-
"./dist/types/exports/utils.d.ts"
176-
],
177-
"wallets": [
178-
"./dist/types/exports/wallets.d.ts"
179-
],
180-
"wallets/*": [
181-
"./dist/types/exports/wallets/*.d.ts"
182-
],
183-
"modules": [
184-
"./dist/types/exports/modules.d.ts"
185-
],
186-
"social": [
187-
"./dist/types/exports/social.d.ts"
188-
],
189-
"ai": [
190-
"./dist/types/exports/ai.d.ts"
191-
]
135+
"adapters/*": ["./dist/types/exports/adapters/*.d.ts"],
136+
"auth": ["./dist/types/exports/auth.d.ts"],
137+
"chains": ["./dist/types/exports/chains.d.ts"],
138+
"contract": ["./dist/types/exports/contract.d.ts"],
139+
"deploys": ["./dist/types/exports/deploys.d.ts"],
140+
"event": ["./dist/types/exports/event.d.ts"],
141+
"extensions/*": ["./dist/types/exports/extensions/*.d.ts"],
142+
"pay": ["./dist/types/exports/pay.d.ts"],
143+
"react": ["./dist/types/exports/react.d.ts"],
144+
"react-native": ["./dist/types/exports/react-native.d.ts"],
145+
"rpc": ["./dist/types/exports/rpc.d.ts"],
146+
"storage": ["./dist/types/exports/storage.d.ts"],
147+
"transaction": ["./dist/types/exports/transaction.d.ts"],
148+
"utils": ["./dist/types/exports/utils.d.ts"],
149+
"wallets": ["./dist/types/exports/wallets.d.ts"],
150+
"wallets/*": ["./dist/types/exports/wallets/*.d.ts"],
151+
"modules": ["./dist/types/exports/modules.d.ts"],
152+
"social": ["./dist/types/exports/social.d.ts"],
153+
"ai": ["./dist/types/exports/ai.d.ts"]
192154
}
193155
},
194156
"browser": {
@@ -210,7 +172,6 @@
210172
"@coinbase/wallet-sdk": "4.3.0",
211173
"@emotion/react": "11.14.0",
212174
"@emotion/styled": "11.14.0",
213-
"@google/model-viewer": "2.1.1",
214175
"@noble/curves": "1.8.1",
215176
"@noble/hashes": "1.7.1",
216177
"@passwordless-id/webauthn": "^2.1.2",

packages/thirdweb/src/react/web/ui/MediaRenderer/MediaRenderer.tsx

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"use client";
2-
import React, { useState, useRef, useEffect, Suspense, lazy } from "react";
2+
import React, { useState, useRef, useEffect } from "react";
33
import {
44
CarbonDocumentAudio,
55
CarbonDocumentUnknown,
@@ -23,7 +23,6 @@ import { useResolvedMediaType } from "./useResolvedMediaType.js";
2323
* - Images
2424
* - Videos
2525
* - Audio files
26-
* - 3D Models
2726
* - SVGs (for [on-chain NFTs](https://blog.thirdweb.com/guides/how-to-create-on-chain-nfts-with-thirdweb/))
2827
* - `iframe` and `HTML`
2928
* - If none of these are appropriate, the fallback is a link to the asset
@@ -32,6 +31,8 @@ import { useResolvedMediaType } from "./useResolvedMediaType.js";
3231
*
3332
* You can use thirdweb CLI to upload any file to IPFS and get the IPFS URI
3433
*
34+
* Note: This component no longer supports 3D models as of v5.92.0!
35+
*
3536
* `npx thirdweb upload <path/to/file>`
3637
* @example
3738
* ```tsx
@@ -107,28 +108,8 @@ export const MediaRenderer = /* @__PURE__ */ (() =>
107108

108109
// 3d model
109110
if (mediaInfo.mimeType.startsWith("model")) {
110-
return (
111-
<Suspense
112-
fallback={
113-
poster ? (
114-
<img
115-
style={mergedStyle}
116-
src={poster}
117-
alt={alt}
118-
ref={ref as unknown as React.LegacyRef<HTMLImageElement>}
119-
className={className}
120-
/>
121-
) : null
122-
}
123-
>
124-
<ModelViewer
125-
style={mergedStyle}
126-
src={mediaInfo.url || ""}
127-
poster={poster}
128-
alt={alt}
129-
className={className}
130-
/>
131-
</Suspense>
111+
console.error(
112+
"Encountered an unsupported media type. 3D model support was removed in v5.92.0. To add a 3D model to your app, use @google/model-viewer and use the ModelViewer component.",
132113
);
133114
}
134115

@@ -197,8 +178,6 @@ export const MediaRenderer = /* @__PURE__ */ (() =>
197178
},
198179
))();
199180

200-
const ModelViewer = /* @__PURE__ */ lazy(() => import("./ModelViewer.js"));
201-
202181
interface PlayButtonProps {
203182
onClick: () => void;
204183
isPlaying: boolean;
@@ -326,14 +305,14 @@ const VideoPlayer = /* @__PURE__ */ (() =>
326305
try {
327306
videoRef.current.play();
328307
} catch (err) {
329-
console.error("error playing video", err);
308+
console.error("Error playing video", err);
330309
}
331310
} else {
332311
try {
333312
videoRef.current.pause();
334313
videoRef.current.currentTime = 0;
335314
} catch (err) {
336-
console.error("error pausing video", err);
315+
console.error("Error pausing video", err);
337316
}
338317
}
339318
}

packages/thirdweb/src/react/web/ui/MediaRenderer/ModelViewer.tsx

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

pnpm-lock.yaml

Lines changed: 18 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)