Skip to content

Commit 494f57d

Browse files
committed
Remove waiting for app details to be ready
1 parent 8d0840c commit 494f57d

File tree

1 file changed

+7
-15
lines changed
  • x-pack/plugins/cases/public/components/cases_context

1 file changed

+7
-15
lines changed

x-pack/plugins/cases/public/components/cases_context/index.tsx

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ import { casesContextReducer, getInitialCasesContextState } from './cases_contex
3232
import { isRegisteredOwner } from '../../files';
3333
import { casesQueryClient } from './query_client';
3434

35-
export type CasesContextValueDispatch = Dispatch<CasesContextStoreAction>;
35+
type CasesContextValueDispatch = Dispatch<CasesContextStoreAction>;
3636

37-
export interface CasesContextValue {
37+
interface CasesContextValue {
3838
externalReferenceAttachmentTypeRegistry: ExternalReferenceAttachmentTypeRegistry;
3939
persistableStateAttachmentTypeRegistry: PersistableStateAttachmentTypeRegistry;
4040
owner: string[];
41-
appId: string;
42-
appTitle: string;
41+
appId?: string;
42+
appTitle?: string;
4343
permissions: CasesPermissions;
4444
basePath: string;
4545
features: CasesFeaturesAllRequired;
@@ -63,11 +63,6 @@ export interface CasesContextProps
6363

6464
export const CasesContext = React.createContext<CasesContextValue | undefined>(undefined);
6565

66-
export interface CasesContextStateValue extends Omit<CasesContextValue, 'appId' | 'appTitle'> {
67-
appId?: string;
68-
appTitle?: string;
69-
}
70-
7166
export const CasesProvider: React.FC<{ value: CasesContextProps }> = ({
7267
children,
7368
value: {
@@ -139,7 +134,7 @@ export const CasesProvider: React.FC<{ value: CasesContextProps }> = ({
139134
[getFilesClient, owner]
140135
);
141136

142-
return isCasesContextValue(value) ? (
137+
return (
143138
<QueryClientProvider client={casesQueryClient}>
144139
<CasesContext.Provider value={value}>
145140
{applyFilesContext(
@@ -150,13 +145,10 @@ export const CasesProvider: React.FC<{ value: CasesContextProps }> = ({
150145
)}
151146
</CasesContext.Provider>
152147
</QueryClientProvider>
153-
) : null;
148+
);
154149
};
155-
CasesProvider.displayName = 'CasesProvider';
156150

157-
function isCasesContextValue(value: CasesContextStateValue): value is CasesContextValue {
158-
return value.appId != null && value.appTitle != null && value.permissions != null;
159-
}
151+
CasesProvider.displayName = 'CasesProvider';
160152

161153
// eslint-disable-next-line import/no-default-export
162154
export default CasesProvider;

0 commit comments

Comments
 (0)