forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix to cache bust issue on memoize functions. we were mutating the ar…
…ray, so the parameters ref wouldn't change when the array grew. also fixed isUserEntered calculation, and another inline function (elastic#66) Co-authored-by: mitodrummer <[email protected]>
- Loading branch information
1 parent
ed725ce
commit 2e53b2a
Showing
5 changed files
with
44 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
x-pack/plugins/session_view/public/components/process_tree/hooks.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { EventAction } from '../../../common/types/process_tree'; | ||
import { mockEvents } from '../../../common/mocks/constants/session_view_process.mock'; | ||
import { ProcessImpl } from './hooks'; | ||
|
||
describe('ProcessTree hooks', () => { | ||
describe('ProcessImpl.getDetails memoize will cache bust on new events', () => { | ||
it('should return the exec event details when this.events changes', () => { | ||
const process = new ProcessImpl(mockEvents[0].process.entity_id); | ||
|
||
process.addEvent(mockEvents[0]); | ||
|
||
let result = process.getDetails(); | ||
|
||
// push exec event | ||
process.addEvent(mockEvents[1]); | ||
|
||
result = process.getDetails(); | ||
|
||
expect(result.event.action).toEqual(EventAction.exec); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters