Skip to content

Commit

Permalink
update AvatarUrlModal form
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo committed Jun 21, 2023
1 parent 1250dd4 commit 852c8c5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 7 additions & 4 deletions src/react-components/avatar-preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,13 @@ class AvatarPreview extends Component {
const newLoadId = ++this.loadId;
const url = proxiedUrlFor(this.props.avatarGltfUrl);
const gltf = await this.loadPreviewAvatar(url);
// If we had started loading another avatar while we were loading this one, throw this one away
if (!this.mounted || newLoadId !== this.loadId) return;
if (gltf && this.props.onGltfLoaded) this.props.onGltfLoaded(gltf);
this.setAvatar(gltf.scene);

if (gltf) {
// If we had started loading another avatar while we were loading this one, throw this one away
if (!this.mounted || newLoadId !== this.loadId) return;
if (gltf && this.props.onGltfLoaded) this.props.onGltfLoaded(gltf);
this.setAvatar(gltf.scene);
}
}

applyMaps(oldProps, newProps) {
Expand Down
3 changes: 1 addition & 2 deletions src/react-components/room/AvatarUrlModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ export function AvatarUrlModal({ onSubmit, onClose }) {
<Modal title="Custom Avatar URL" beforeTitle={<CloseButton onClick={onClose} />}>
<Column as="form" padding center onSubmit={handleSubmit(onSubmit)}>
<TextInputField
name="url"
label={<FormattedMessage id="avatar-url-modal.avatar-url-label" defaultMessage="Avatar GLB URL" />}
placeholder="https://example.com/avatar.glb"
type="url"
required
ref={register}
{...register("url")}
description={
<a href="https://hubs.mozilla.com/docs/intro-avatars.html" target="_blank" rel="noopener noreferrer">
<FormattedMessage
Expand Down

0 comments on commit 852c8c5

Please sign in to comment.