Fix issue with auto updating captions when captioning a dataset
This commit is contained in:
1 parent
765a9d5b2e
commit
145144eee3
1 file changed
+3
-3
@@ -80,7 +80,7 @@ const DatasetImageCard: React.FC<DatasetImageCardProps> = ({
|
|||||||
if (inViewport && isVisible) {
|
if (inViewport && isVisible) {
|
||||||
fetchCaption();
|
fetchCaption();
|
||||||
}
|
}
|
||||||
}, [inViewport, isVisible]);
|
}, [inViewport, isVisible, isCaptionLoaded]);
|
||||||
|
|
||||||
// Poll for caption updates every 5 seconds while auto-captioning
|
// Poll for caption updates every 5 seconds while auto-captioning
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -241,7 +241,7 @@ const DatasetImageCard: React.FC<DatasetImageCardProps> = ({
|
|||||||
'border-transparent border-2': isCaptionCurrent,
|
'border-transparent border-2': isCaptionCurrent,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
{inViewport && isVisible && isCaptionLoaded && (
|
{inViewport && isVisible && (isCaptionLoaded || caption) && (
|
||||||
<form
|
<form
|
||||||
onSubmit={e => {
|
onSubmit={e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -266,7 +266,7 @@ const DatasetImageCard: React.FC<DatasetImageCardProps> = ({
|
|||||||
{isVisible ? 'Scroll into view to edit caption' : 'Show content to edit caption'}
|
{isVisible ? 'Scroll into view to edit caption' : 'Show content to edit caption'}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{!isCaptionLoaded && (
|
{!isCaptionLoaded && !caption && (
|
||||||
<div className="w-full h-full flex items-center justify-center text-gray-400">Loading caption...</div>
|
<div className="w-full h-full flex items-center justify-center text-gray-400">Loading caption...</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user