File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
packages/compass-connections/src/components Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -45,14 +45,19 @@ const footerStyles = css({
4545
4646const useLegacyModel = ( ) => {
4747 const connectionStorage = useConnectionStorageContext ( ) ;
48- const getLegacyConnectionsImpl =
49- connectionStorage . getLegacyConnections ?. bind ( connectionStorage ) ;
50- if ( ! getLegacyConnectionsImpl ) {
48+ if ( typeof connectionStorage . getLegacyConnections !== 'function' ) {
5149 throw new Error (
5250 'LegacyConnections migrations require provided ConnectionStorage to implement getLegacyConnections'
5351 ) ;
5452 }
5553
54+ const getLegacyConnectionsImpl = useCallback (
55+ async ( options ?: { signal : AbortSignal | undefined } ) => {
56+ return await connectionStorage . getLegacyConnections ?.( options ) ;
57+ } ,
58+ [ connectionStorage ]
59+ ) ;
60+
5661 const [ connections , setConnections ] = useState < { name : string } [ ] > ( [ ] ) ;
5762
5863 const [ isModalHiddenByUser , setIsModalHiddenByUser ] = usePersistedState (
@@ -61,9 +66,11 @@ const useLegacyModel = () => {
6166 ) ;
6267
6368 useEffect ( ( ) => {
64- void getLegacyConnectionsImpl ( ) . then ( ( connections ) =>
65- setConnections ( connections )
66- ) ;
69+ void getLegacyConnectionsImpl ( ) . then ( ( connections ) => {
70+ if ( connections ) {
71+ setConnections ( connections ) ;
72+ }
73+ } ) ;
6774 } , [ getLegacyConnectionsImpl ] ) ;
6875
6976 return {
You can’t perform that action at this time.
0 commit comments