File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,14 +47,12 @@ function Tables() {
4747 </ Card >
4848 ) ;
4949
50- const requestedTableMissing =
51- ! ! table && ! data . tables . some ( ( { name } ) => name === table ) ;
50+ const requestedTableIndex = table
51+ ? data . tables . findIndex ( ( { name } ) => name === table )
52+ : - 1 ;
5253
53- const tab = ( ( ) => {
54- if ( ! table ) return "0" ;
55- const index = data . tables . findIndex ( ( { name } ) => name === table ) ;
56- return ( index >= 0 ? index : 0 ) . toString ( ) ;
57- } ) ( ) ;
54+ const requestedTableMissing = ! ! table && requestedTableIndex < 0 ;
55+ const tab = String ( Math . max ( requestedTableIndex , 0 ) ) ;
5856
5957 return (
6058 < >
@@ -70,7 +68,7 @@ function Tables() {
7068 </ Card >
7169 ) }
7270
73- < Tabs defaultValue = { tab } >
71+ < Tabs key = { tab } defaultValue = { tab } >
7472 < TabsList >
7573 { data . tables . map ( ( n , i ) => (
7674 < TabsTrigger key = { i } value = { i . toString ( ) } >
You can’t perform that action at this time.
0 commit comments