fix: align frontend types and tests for react 19 (#339)
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// MedicationAvatar Component
|
||||
// =============================================================================
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
|
||||
export type MedicationAvatarProps = {
|
||||
name: string;
|
||||
@@ -12,8 +12,11 @@ export type MedicationAvatarProps = {
|
||||
|
||||
export function MedicationAvatar({ name, imageUrl, size = "sm" }: MedicationAvatarProps) {
|
||||
const [thumbFailed, setThumbFailed] = useState(false);
|
||||
const previousImageUrlRef = useRef(imageUrl);
|
||||
|
||||
useEffect(() => {
|
||||
if (previousImageUrlRef.current === imageUrl) return;
|
||||
previousImageUrlRef.current = imageUrl;
|
||||
setThumbFailed(false);
|
||||
}, [imageUrl]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user