mirror of
https://github.com/grafana/grafana.git
synced 2024-11-29 12:14:08 -06:00
Dont parse empty explore state from url
- only parse url state if there is any - prevents parse exception in the console on empty explore state
This commit is contained in:
parent
a1f0dffe01
commit
f67b27e009
@ -31,18 +31,20 @@ function makeTimeSeriesList(dataList, options) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseInitialState(initial) {
|
function parseInitialState(initial: string | undefined) {
|
||||||
try {
|
if (initial) {
|
||||||
const parsed = JSON.parse(decodePathComponent(initial));
|
try {
|
||||||
return {
|
const parsed = JSON.parse(decodePathComponent(initial));
|
||||||
datasource: parsed.datasource,
|
return {
|
||||||
queries: parsed.queries.map(q => q.query),
|
datasource: parsed.datasource,
|
||||||
range: parsed.range,
|
queries: parsed.queries.map(q => q.query),
|
||||||
};
|
range: parsed.range,
|
||||||
} catch (e) {
|
};
|
||||||
console.error(e);
|
} catch (e) {
|
||||||
return { queries: [], range: DEFAULT_RANGE };
|
console.error(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return { datasource: null, queries: [], range: DEFAULT_RANGE };
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IExploreState {
|
interface IExploreState {
|
||||||
|
Loading…
Reference in New Issue
Block a user