Skip to content

Commit

Permalink
fix avatar src bug
Browse files Browse the repository at this point in the history
  • Loading branch information
huntabyte committed Oct 21, 2023
1 parent 4b00484 commit c6f66e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib/bits/avatar/components/AvatarImage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
export let alt: $$Props["alt"] = undefined;
export let asChild = false;
const image = ctx.getImage(src).elements.image;
$: image = ctx.getImage(src).elements.image;
</script>

{#if asChild}
Expand Down
4 changes: 3 additions & 1 deletion src/lib/bits/avatar/ctx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ function set(props: CreateAvatarProps) {

function getImage(src: string | undefined | null = "") {
const avatar = getContext<AvatarReturn>(NAME);
if (src) {
if (!src) {
avatar.options.src.set("");
} else {
avatar.options.src.set(src);
}
return avatar;
Expand Down

0 comments on commit c6f66e4

Please sign in to comment.