File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ const VALID_EXTENSIONS = ["csv", "json"];
28
28
29
29
function DBExplorerInner ( props : DBExplorerInnerProps ) {
30
30
const { content, extension, filename, sha } = props ;
31
- const connectionRef = useRef < duckdb . AsyncDuckDBConnection > ( ) ;
31
+ const connectionRef = useRef < duckdb . AsyncDuckDBConnection | null > ( null ) ;
32
32
const [ query , setQuery ] = useState ( "" ) ;
33
33
const [ debouncedQuery ] = useDebounce ( query , 500 ) ;
34
34
const [ dbStatus , setDbStatus ] = useState < "error" | "idle" | "success" > (
@@ -98,9 +98,11 @@ function DBExplorerInner(props: DBExplorerInnerProps) {
98
98
return ( ) => {
99
99
if ( connectionRef . current ) {
100
100
connectionRef . current . close ( ) ;
101
+ connectionRef . current = null ;
102
+ setDbStatus ( "idle" ) ;
101
103
}
102
104
} ;
103
- } , [ content ] ) ;
105
+ } , [ content , sha , filename ] ) ;
104
106
105
107
const sqlSchema = useMemo ( ( ) => {
106
108
if ( ! content ) return [ ] ;
You can’t perform that action at this time.
0 commit comments