@@ -161,20 +161,6 @@ const DatasetDetailPage: React.FC = () => {
161161 const [ isPreviewLoading , setIsPreviewLoading ] = useState ( false ) ;
162162 const [ readyPreviewData , setReadyPreviewData ] = useState < any > ( null ) ;
163163
164- // const onPreviewReady = (decodedData: any) => {
165- // console.log("✅ Data is ready! Opening modal.");
166- // setReadyPreviewData(decodedData); // Store the final data
167- // setIsPreviewLoading(false); // Hide the spinner
168- // setPreviewOpen(true); // NOW open the modal
169- // };
170-
171- // Dataset download button size calculation function
172- // const formatSize = (sizeInBytes: number): string => {
173- // if (sizeInBytes < 1024 * 1024) {
174- // return `${(sizeInBytes / 1024).toFixed(1)} KB`;
175- // }
176- // return `${(sizeInBytes / 1024 / 1024).toFixed(2)} MB`;
177- // };
178164 const formatSize = ( sizeInBytes : number ) : string => {
179165 if ( sizeInBytes < 1024 ) {
180166 return `${ sizeInBytes } Bytes` ;
@@ -302,16 +288,6 @@ const DatasetDetailPage: React.FC = () => {
302288 return internalLinks ;
303289 } ;
304290
305- // const formatFileSize = (bytes: number): string => {
306- // if (bytes >= 1024 * 1024 * 1024) {
307- // return `${Math.floor(bytes / (1024 * 1024 * 1024))} GB`;
308- // } else if (bytes >= 1024 * 1024) {
309- // return `${Math.floor(bytes / (1024 * 1024))} MB`;
310- // } else {
311- // return `${Math.floor(bytes / 1024)} KB`;
312- // }
313- // };
314-
315291 useEffect ( ( ) => {
316292 const fetchData = async ( ) => {
317293 if ( dbName && docId ) {
@@ -498,8 +474,10 @@ const DatasetDetailPage: React.FC = () => {
498474 "Is Internal:" ,
499475 isInternal
500476 ) ;
477+
501478 // Clear any stale preview type from last run
502479 delete ( window as any ) . __previewType ;
480+
503481 // fix spinner
504482 setIsPreviewLoading ( true ) ; // Show the spinner overlay
505483 setPreviewIndex ( idx ) ;
@@ -518,6 +496,7 @@ const DatasetDetailPage: React.FC = () => {
518496
519497 const is2DPreviewCandidate = ( obj : any ) : boolean => {
520498 if ( typeof window !== "undefined" && ( window as any ) . __previewType ) {
499+ console . log ( "work~~~~~~~" ) ;
521500 return ( window as any ) . __previewType === "2d" ;
522501 }
523502 // if (window.__previewType) {
0 commit comments