fix: refresh lightbox tags live after AI tagging, hide AI tags button for video

This commit is contained in:
2026-04-08 17:15:44 +01:00
parent a9dd2b2797
commit f93a80bc87
+8 -1
View File
@@ -102,7 +102,12 @@ export function Lightbox() {
void getImageTags(selectedImage.id) void getImageTags(selectedImage.id)
.then(setImageTags) .then(setImageTags)
.catch(() => setImageTags([])); .catch(() => setImageTags([]));
}, [selectedImage?.id, getImageTags]); }, [selectedImage?.id, selectedImage?.ai_tagged_at, getImageTags]);
// Reset the queued state once the worker finishes so the button is usable again
useEffect(() => {
if (selectedImage?.ai_tagged_at) setTaggingQueued(false);
}, [selectedImage?.ai_tagged_at]);
useEffect(() => { useEffect(() => {
const viewport = imageViewportRef.current; const viewport = imageViewportRef.current;
@@ -359,6 +364,7 @@ export function Lightbox() {
{ratingPill(selectedImage.ai_rating).label} {ratingPill(selectedImage.ai_rating).label}
</span> </span>
) : null} ) : null}
{selectedImage.media_kind === "image" ? (
<button <button
className="rounded-md border border-white/10 bg-white/5 px-2 py-0.5 text-[10px] text-gray-400 transition-colors hover:bg-white/10 hover:text-white disabled:cursor-not-allowed disabled:opacity-40" className="rounded-md border border-white/10 bg-white/5 px-2 py-0.5 text-[10px] text-gray-400 transition-colors hover:bg-white/10 hover:text-white disabled:cursor-not-allowed disabled:opacity-40"
disabled={!(taggerModelStatus?.ready ?? false) || taggingQueued} disabled={!(taggerModelStatus?.ready ?? false) || taggingQueued}
@@ -370,6 +376,7 @@ export function Lightbox() {
> >
{taggingQueued ? "Queued" : "AI tags"} {taggingQueued ? "Queued" : "AI tags"}
</button> </button>
) : null}
</div> </div>
</div> </div>