Skip to content

Commit

Permalink
feat: remove save the last query to local storage (#1853)
Browse files Browse the repository at this point in the history
  • Loading branch information
Loori-R committed Nov 29, 2021
1 parent 1b58d12 commit c6d5927
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
Expand Up @@ -2,7 +2,6 @@ import {useEffect, useMemo, useState} from "react";
import {getQueryRangeUrl, getQueryUrl} from "../../../api/query-range";
import {useAppState} from "../../../state/common/StateContext";
import {InstantMetricResult, MetricResult} from "../../../api/types";
import {saveToStorage} from "../../../utils/storage";
import {isValidHttpUrl} from "../../../utils/url";
import {useAuthState} from "../../../state/auth/AuthStateContext";
import {TimeParams} from "../../../types";
Expand Down Expand Up @@ -56,7 +55,6 @@ export const useFetchQuery = (): {
try {
const response = await fetch(fetchUrl, { headers });
if (response.ok) {
saveToStorage("LAST_QUERY", query);
const resp = await response.json();
setError(undefined);
displayType === "chart" ? setGraphData(resp.data.result) : setLiveData(resp.data.result);
Expand Down
2 changes: 1 addition & 1 deletion app/vmui/packages/vmui/src/state/common/reducer.ts
Expand Up @@ -46,7 +46,7 @@ export type Action =

const duration = getQueryStringValue("g0.range_input", "1h") as string;
const endInput = formatDateToLocal(getQueryStringValue("g0.end_input", getDateNowUTC()) as Date);
const query = getQueryStringValue("g0.expr", getFromStorage("LAST_QUERY") as string || "\n") as string;
const query = getQueryStringValue("g0.expr", "") as string;

export const initialState: AppState = {
serverUrl: getDefaultServer(),
Expand Down
3 changes: 1 addition & 2 deletions app/vmui/packages/vmui/src/utils/storage.ts
@@ -1,5 +1,4 @@
export type StorageKeys = "LAST_QUERY"
| "BASIC_AUTH_DATA"
export type StorageKeys = "BASIC_AUTH_DATA"
| "BEARER_AUTH_DATA"
| "AUTH_TYPE"
| "AUTOCOMPLETE"
Expand Down

0 comments on commit c6d5927

Please sign in to comment.