diff --git a/client/src/components/Artifacts/Artifacts.tsx b/client/src/components/Artifacts/Artifacts.tsx index 161919fda2..79db64bd15 100644 --- a/client/src/components/Artifacts/Artifacts.tsx +++ b/client/src/components/Artifacts/Artifacts.tsx @@ -1,4 +1,4 @@ -import React, { useMemo, useState } from 'react'; +import React, { useMemo, useState, useEffect } from 'react'; import { useRecoilValue } from 'recoil'; import * as Tabs from '@radix-ui/react-tabs'; import { Sandpack } from '@codesandbox/sandpack-react'; @@ -59,10 +59,15 @@ export function ArtifactPreview({ } export default function Artifacts() { + const [isVisible, setIsVisible] = useState(false); const [activeTab, setActiveTab] = useState('code'); const artifacts = useRecoilValue(store.artifactsState); const artifactIds = useRecoilValue(store.artifactIdsState); + useEffect(() => { + setIsVisible(true); + }, []); + const [currentArtifactIndex, setCurrentArtifactIndex] = useState(artifactIds.length - 1); const currentArtifact = useMemo(() => { @@ -92,7 +97,13 @@ export default function Artifacts() { {/* Main Parent */}