Frontend: [hour/s old bug] Ensure type null option for lastEditedQueryId (#14055)

This commit is contained in:
RachelElysia
2023-09-21 14:51:13 -04:00
committed by GitHub
parent fe7d9f9f8b
commit fd4e2733ba
2 changed files with 11 additions and 8 deletions
+9 -6
View File
@@ -165,12 +165,15 @@ const PolicyProvider = ({ children }: Props): JSX.Element => {
dispatch({ type: ACTIONS.SET_POLICY_TEAM_ID, id });
}, []);
const setLastEditedQueryId = useCallback((lastEditedQueryId: number) => {
dispatch({
type: ACTIONS.SET_LAST_EDITED_QUERY_INFO,
lastEditedQueryId,
});
}, []);
const setLastEditedQueryId = useCallback(
(lastEditedQueryId: number | null) => {
dispatch({
type: ACTIONS.SET_LAST_EDITED_QUERY_INFO,
lastEditedQueryId,
});
},
[]
);
const setLastEditedQueryName = useCallback((lastEditedQueryName: string) => {
dispatch({
+2 -2
View File
@@ -22,7 +22,7 @@ type InitialStateType = {
lastEditedQueryPlatforms: SelectedPlatformString;
lastEditedQueryMinOsqueryVersion: string;
lastEditedQueryLoggingType: QueryLoggingOption;
setLastEditedQueryId: (value: number) => void;
setLastEditedQueryId: (value: number | null) => void;
setLastEditedQueryName: (value: string) => void;
setLastEditedQueryDescription: (value: string) => void;
setLastEditedQueryBody: (value: string) => void;
@@ -135,7 +135,7 @@ const QueryProvider = ({ children }: Props) => {
lastEditedQueryPlatforms: state.lastEditedQueryPlatforms,
lastEditedQueryMinOsqueryVersion: state.lastEditedQueryMinOsqueryVersion,
lastEditedQueryLoggingType: state.lastEditedQueryLoggingType,
setLastEditedQueryId: (lastEditedQueryId: number) => {
setLastEditedQueryId: (lastEditedQueryId: number | null) => {
dispatch({
type: actions.SET_LAST_EDITED_QUERY_INFO,
lastEditedQueryId,