Skip to content

Commit

Permalink
Fix pristine logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jloleysens committed Nov 26, 2019
1 parent a7a50b0 commit 0baf5b7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,15 @@ import { OnHighlightChangeArgs } from '../components/profile_tree';
import { ShardSerialized, Targets } from '../types';

export type Action =
| { type: 'setPristine'; value: boolean }
| { type: 'setProfiling'; value: boolean }
| { type: 'setHighlightDetails'; value: OnHighlightChangeArgs | null }
| { type: 'setActiveTab'; value: Targets | null }
| { type: 'setCurrentResponse'; value: ShardSerialized[] | null };

export const reducer: Reducer<State, Action> = (state, action) =>
produce<State>(state, draft => {
if (action.type === 'setPristine') {
draft.pristine = action.value;
return;
}

if (action.type === 'setProfiling') {
draft.pristine = false;
draft.profiling = action.value;
if (draft.profiling) {
draft.currentResponse = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface State {

export const initialState: State = {
profiling: false,
pristine: false,
pristine: true,
highlightDetails: null,
activeTab: null,
currentResponse: null,
Expand Down

0 comments on commit 0baf5b7

Please sign in to comment.