🚀 Auto-deploy: melhoria no snap e medição AR em 25/05/2026 11:54:52
This commit is contained in:
@@ -404,10 +404,52 @@ function MiiAvatarBackup({
|
||||
);
|
||||
}
|
||||
|
||||
// ==========================================
|
||||
// CLASSES E COMPONENTES DE RESILIÊNCIA
|
||||
// ==========================================
|
||||
class AvatarErrorBoundary extends React.Component<{ fallback: React.ReactNode; children: React.ReactNode }, { hasError: boolean }> {
|
||||
constructor(props: { fallback: React.ReactNode; children: React.ReactNode }) {
|
||||
super(props);
|
||||
this.state = { hasError: false };
|
||||
}
|
||||
|
||||
static getDerivedStateFromError() {
|
||||
return { hasError: true };
|
||||
}
|
||||
|
||||
componentDidCatch(error: any) {
|
||||
console.warn("🚨 [AvatarErrorBoundary] Falha ao carregar o modelo GLB do avatar. Utilizando o avatar de fallback procedural.", error);
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.state.hasError) {
|
||||
return this.props.fallback;
|
||||
}
|
||||
return this.props.children;
|
||||
}
|
||||
}
|
||||
|
||||
// O componente principal MiiAvatar agora é um wrapper resiliente com Suspense e ErrorBoundary
|
||||
function MiiAvatar(props: {
|
||||
avatarId: number;
|
||||
username: string;
|
||||
isTalking?: boolean;
|
||||
scale?: number;
|
||||
isLastChatSender?: boolean;
|
||||
} & Record<string, unknown>) {
|
||||
return (
|
||||
<AvatarErrorBoundary fallback={<MiiAvatarBackup {...props} />}>
|
||||
<Suspense fallback={<MiiAvatarBackup {...props} />}>
|
||||
<RealMiiAvatar {...props} />
|
||||
</Suspense>
|
||||
</AvatarErrorBoundary>
|
||||
);
|
||||
}
|
||||
|
||||
// ==========================================
|
||||
// NOVOS AVATARES REALISTAS (READY PLAYER ME)
|
||||
// ==========================================
|
||||
function MiiAvatar({
|
||||
function RealMiiAvatar({
|
||||
avatarId,
|
||||
username,
|
||||
isTalking,
|
||||
|
||||
Reference in New Issue
Block a user