@parca/store
Advanced tools
Comparing version 0.16.51 to 0.16.52
@@ -6,2 +6,6 @@ # Change Log | ||
## 0.16.52 (2023-01-11) | ||
**Note:** Version bump only for package @parca/store | ||
## 0.16.51 (2022-12-20) | ||
@@ -8,0 +12,0 @@ |
import { PayloadAction } from '@reduxjs/toolkit'; | ||
import type { RootState } from '../store'; | ||
export interface ProfileState { | ||
compare: boolean; | ||
searchNodeString: string | undefined; | ||
filterByFunction: string | undefined; | ||
[key: string]: string | string[] | undefined; | ||
} | ||
export declare const profileSlice: import("@reduxjs/toolkit").Slice<ProfileState, { | ||
setCompare: (state: import("immer/dist/internal").WritableDraft<ProfileState>, action: PayloadAction<boolean>) => void; | ||
setSearchNodeString: (state: import("immer/dist/internal").WritableDraft<ProfileState>, action: PayloadAction<string | undefined>) => void; | ||
setFilterByFunction: (state: import("immer/dist/internal").WritableDraft<ProfileState>, action: PayloadAction<string | undefined>) => void; | ||
setProfileStateValue: (state: import("immer/dist/internal").WritableDraft<ProfileState>, action: PayloadAction<{ | ||
key: string; | ||
value: string | string[] | undefined; | ||
}>) => void; | ||
}, "profile">; | ||
export declare const setCompare: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<boolean, "profile/setCompare">, setSearchNodeString: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string, "profile/setSearchNodeString">, setFilterByFunction: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string, "profile/setFilterByFunction">; | ||
export declare const selectCompareMode: (state: RootState) => boolean; | ||
export declare const selectSearchNodeString: (state: RootState) => string | undefined; | ||
export declare const setProfileStateValue: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<{ | ||
key: string; | ||
value: string | string[] | undefined; | ||
}, "profile/setProfileStateValue">; | ||
export declare const selectFilterByFunction: (state: RootState) => string | undefined; | ||
export declare const selectProfileStateValue: (key: string) => (state: RootState) => string | string[]; | ||
declare const _default: import("redux").Reducer<ProfileState, import("redux").AnyAction>; | ||
export default _default; |
@@ -13,8 +13,5 @@ // Copyright 2022 The Parca Authors | ||
// limitations under the License. | ||
var _a; | ||
import { createSlice } from '@reduxjs/toolkit'; | ||
// Define the initial state using that type | ||
var initialState = { | ||
compare: false, | ||
searchNodeString: undefined, | ||
filterByFunction: undefined, | ||
@@ -26,23 +23,14 @@ }; | ||
reducers: { | ||
// Use the PayloadAction type to declare the contents of `action.payload` | ||
setCompare: function (state, action) { | ||
state.compare = action.payload; | ||
setProfileStateValue: function (state, action) { | ||
state[action.payload.key] = action.payload.value; | ||
}, | ||
setSearchNodeString: function (state, action) { | ||
state.searchNodeString = action.payload; | ||
}, | ||
setFilterByFunction: function (state, action) { | ||
state.filterByFunction = action.payload; | ||
}, | ||
}, | ||
}); | ||
export var setCompare = (_a = profileSlice.actions, _a.setCompare), setSearchNodeString = _a.setSearchNodeString, setFilterByFunction = _a.setFilterByFunction; | ||
// Other code such as selectors can use the imported `RootState` type | ||
export var selectCompareMode = function (state) { return state.profile.compare; }; | ||
export var selectSearchNodeString = function (state) { | ||
return state.profile.searchNodeString; | ||
}; | ||
export var setProfileStateValue = profileSlice.actions.setProfileStateValue; | ||
export var selectFilterByFunction = function (state) { | ||
return state.profile.filterByFunction; | ||
}; | ||
export var selectProfileStateValue = function (key) { return function (state) { | ||
return state.profile[key]; | ||
}; }; | ||
export default profileSlice.reducer; |
/// <reference types="redux-persist/types/persistReducer" /> | ||
import { UiState } from './slices/uiSlice'; | ||
import { ProfileState } from './slices/profileSlice'; | ||
import { UiState } from './slices/uiSlice'; | ||
import { Persistor } from 'redux-persist'; | ||
@@ -5,0 +5,0 @@ import { Store } from 'redux'; |
@@ -14,4 +14,4 @@ // Copyright 2022 The Parca Authors | ||
import { configureStore, combineReducers } from '@reduxjs/toolkit'; | ||
import uiReducer from './slices/uiSlice'; | ||
import profileReducer from './slices/profileSlice'; | ||
import uiReducer from './slices/uiSlice'; | ||
import storage from 'redux-persist/lib/storage'; | ||
@@ -18,0 +18,0 @@ import { persistReducer, FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER, persistStore, } from 'redux-persist'; |
{ | ||
"name": "@parca/store", | ||
"version": "0.16.51", | ||
"version": "0.16.52", | ||
"description": "State management for Parca UI", | ||
@@ -24,3 +24,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "de3039d619347aa29a374871a6cbb4f53aa72d6a" | ||
"gitHead": "1dd773ebc4ab83aec05bbb78f72f0c1cc74cb869" | ||
} |
@@ -19,5 +19,4 @@ // Copyright 2022 The Parca Authors | ||
export interface ProfileState { | ||
compare: boolean; | ||
searchNodeString: string | undefined; | ||
filterByFunction: string | undefined; | ||
[key: string]: string | string[] | undefined; | ||
} | ||
@@ -27,4 +26,2 @@ | ||
const initialState: ProfileState = { | ||
compare: false, | ||
searchNodeString: undefined, | ||
filterByFunction: undefined, | ||
@@ -37,24 +34,19 @@ }; | ||
reducers: { | ||
// Use the PayloadAction type to declare the contents of `action.payload` | ||
setCompare: (state, action: PayloadAction<boolean>) => { | ||
state.compare = action.payload; | ||
setProfileStateValue: ( | ||
state, | ||
action: PayloadAction<{key: string; value: string | string[] | undefined}> | ||
) => { | ||
state[action.payload.key] = action.payload.value; | ||
}, | ||
setSearchNodeString: (state, action: PayloadAction<string | undefined>) => { | ||
state.searchNodeString = action.payload; | ||
}, | ||
setFilterByFunction: (state, action: PayloadAction<string | undefined>) => { | ||
state.filterByFunction = action.payload; | ||
}, | ||
}, | ||
}); | ||
export const {setCompare, setSearchNodeString, setFilterByFunction} = profileSlice.actions; | ||
export const {setProfileStateValue} = profileSlice.actions; | ||
// Other code such as selectors can use the imported `RootState` type | ||
export const selectCompareMode = (state: RootState): boolean => state.profile.compare; | ||
export const selectSearchNodeString = (state: RootState): string | undefined => | ||
state.profile.searchNodeString; | ||
export const selectFilterByFunction = (state: RootState): string | undefined => | ||
state.profile.filterByFunction; | ||
export const selectProfileStateValue = (key: string) => (state: RootState) => { | ||
return state.profile[key]; | ||
}; | ||
export default profileSlice.reducer; |
@@ -15,4 +15,4 @@ // Copyright 2022 The Parca Authors | ||
import {configureStore, combineReducers} from '@reduxjs/toolkit'; | ||
import uiReducer, {UiState} from './slices/uiSlice'; | ||
import profileReducer, {ProfileState} from './slices/profileSlice'; | ||
import uiReducer, {UiState} from './slices/uiSlice'; | ||
import storage from 'redux-persist/lib/storage'; | ||
@@ -19,0 +19,0 @@ import { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32486
395