Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(avatars): stop the gallery picker throwing when it is closed on the frame it opens

nirholas3a053d758822
diff --git a/src/avatar-gallery-picker.js b/src/avatar-gallery-picker.js
index b56ae7459..81057d678 100644
--- a/src/avatar-gallery-picker.js
+++ b/src/avatar-gallery-picker.js
@@ -131,6 +131,11 @@ export class AvatarGalleryPicker {
document.addEventListener('keydown', this._onKey);
requestAnimationFrame(() => {
+ // close() nulls _overlay, and a picker dismissed inside the one frame
+ // between mounting and this callback (Escape on a slow first paint, or a
+ // backdrop click landing early) left this dereferencing null and throwing
+ // on the player's console. Nothing to animate in if it is already gone.
+ if (!this._overlay) return;
this._overlay.classList.add('agp-open');
this._els.searchInput?.focus();
});