Skip to content

Commit

Permalink
Update type for initial state of component id
Browse files Browse the repository at this point in the history
  • Loading branch information
kqualters-elastic committed Jul 14, 2020
1 parent 364ac4c commit 9d2eeca
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,11 @@ describe('data state', () => {
expect(selectors.isLoading(state())).toBe(true);
});
it('should need to fetch the second databaseDocumentID', () => {
expect(selectors.databaseDocumentIDToFetch(state())).toBe(firstDatabaseDocumentID);
expect(selectors.databaseDocumentIDToFetch(state())).toBe(secondDatabaseDocumentID);
});
it('should need to abort the request for the databaseDocumentID', () => {
expect(selectors.databaseDocumentIDToFetch(state())).toBe(secondDatabaseDocumentID);
});
it('should use the correct location for the first resolver', () => {
expect(selectors.resolverComponentInstanceID(state())).toBe(resolverComponentInstanceID1);
});
it('should use the correct location for the second resolver', () => {
expect(selectors.resolverComponentInstanceID(state())).toBe(resolverComponentInstanceID2);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function isLoading(state: DataState): boolean {
* A string for uniquely identifying the instance of resolver within the app.
*/
export function resolverComponentInstanceID(state: DataState): string {
return state.resolverComponentInstanceID;
return state.resolverComponentInstanceID ? state.resolverComponentInstanceID : '';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/security_solution/public/resolver/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export interface DataState {
* The id used for the pending request, if there is one.
*/
readonly pendingRequestDatabaseDocumentID?: string;
readonly resolverComponentInstanceID: string;
readonly resolverComponentInstanceID: string | undefined;

/**
* The parameters and response from the last successful request.
Expand Down

0 comments on commit 9d2eeca

Please sign in to comment.