File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed
packages/jsapi-bootstrap/src Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -26,9 +26,9 @@ export const DeferredApiContext = createContext<
26
26
*/
27
27
export function useDeferredApi (
28
28
widget : DhType . ide . VariableDescriptor | UriVariableDescriptor | null
29
- ) : [ dh : typeof DhType | null , error : unknown | null ] {
29
+ ) : [ dh : typeof DhType | null , error : NonNullable < unknown > | null ] {
30
30
const [ api , setApi ] = useState < typeof DhType | null > ( null ) ;
31
- const [ error , setError ] = useState < unknown | null > ( null ) ;
31
+ const [ error , setError ] = useState < NonNullable < unknown > | null > ( null ) ;
32
32
const deferredApi = useContext ( DeferredApiContext ) ;
33
33
const contextApi = useContext ( ApiContext ) ;
34
34
@@ -63,7 +63,7 @@ export function useDeferredApi(
63
63
setError ( null ) ;
64
64
}
65
65
} catch ( e ) {
66
- if ( ! isCancelled ) {
66
+ if ( ! isCancelled && e != null ) {
67
67
setApi ( null ) ;
68
68
setError ( e ) ;
69
69
}
Original file line number Diff line number Diff line change @@ -112,8 +112,7 @@ export function useWidget<T extends WidgetTypes = dh.Widget>(
112
112
const wrapperWithApi = useMemo (
113
113
( ) => ( {
114
114
...wrapper ,
115
- error :
116
- wrapper . error ?? ( descriptorApiError as NonNullable < unknown > | null ) ,
115
+ error : wrapper . error ?? descriptorApiError ,
117
116
api : wrapper . widget != null ? api : null ,
118
117
} ) ,
119
118
[ wrapper , api , descriptorApiError ]
You can’t perform that action at this time.
0 commit comments