File tree Expand file tree Collapse file tree 3 files changed +12
-7
lines changed
x-pack/plugins/cases/public Expand file tree Collapse file tree 3 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ import type { ScopedFilesClient } from '@kbn/files-plugin/public';
1919import { euiDarkVars } from '@kbn/ui-theme' ;
2020import { I18nProvider } from '@kbn/i18n-react' ;
2121import { createMockFilesClient } from '@kbn/shared-ux-file-mocks' ;
22- import { QueryClient , QueryClientProvider } from '@tanstack/react-query' ;
22+ import { QueryClient } from '@tanstack/react-query' ;
2323
2424import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public' ;
2525import { FilesContext } from '@kbn/shared-ux-file-context' ;
@@ -108,10 +108,9 @@ const TestProvidersComponent: React.FC<TestProviderProps> = ({
108108 permissions,
109109 getFilesClient,
110110 } }
111+ queryClient = { queryClient }
111112 >
112- < QueryClientProvider client = { queryClient } >
113- < FilesContext client = { createMockFilesClient ( ) } > { children } </ FilesContext >
114- </ QueryClientProvider >
113+ < FilesContext client = { createMockFilesClient ( ) } > { children } </ FilesContext >
115114 </ CasesProvider >
116115 </ MemoryRouter >
117116 </ ThemeProvider >
Original file line number Diff line number Diff line change @@ -13,12 +13,19 @@ interface UseApplicationReturn {
1313 appTitle : string | undefined ;
1414}
1515
16+ const isBehaviorSubjectObservable = < T , > (
17+ observable : Observable < T >
18+ ) : observable is BehaviorSubject < T > => 'value' in observable ;
19+
1620/**
1721 * Checks if the observable is stateful and, in case, sets up `useObservable` with an initial value
1822 */
1923const useStatefulObservable = < T , > ( observable : Observable < T > ) => {
20- const defaultValue = 'value' in observable ? ( observable as BehaviorSubject < T > ) . value : undefined ;
21- return useObservable ( observable , defaultValue ) ;
24+ let initialValue : T | undefined ;
25+ if ( isBehaviorSubjectObservable ( observable ) ) {
26+ initialValue = observable . value ;
27+ }
28+ return useObservable ( observable , initialValue ) ;
2229} ;
2330
2431export const useApplication = ( ) : UseApplicationReturn => {
Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ import { MAX_DESCRIPTION_LENGTH } from '../../../common/constants';
1717import { FormTestComponent } from '../../common/test_utils' ;
1818import type { FormSchema } from '@kbn/index-management-plugin/public/shared_imports' ;
1919
20- // FLAKY: https://github.com/elastic/kibana/issues/175204
2120describe ( 'Description' , ( ) => {
2221 let appMockRender : AppMockRenderer ;
2322 const onSubmit = jest . fn ( ) ;
You can’t perform that action at this time.
0 commit comments