Explore: handle URLs parse errors (#77784)

* Explore: handle URLs parse errors

* minor modifications

* tentative fix

* update docs

* omit v0 params from the final url

* Apply suggestions from code review

Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com>

* remove safeParseJson, make parse return an object

---------

Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com>
This commit is contained in:
Giordano Ricci
2023-11-20 13:54:00 +00:00
committed by GitHub
co-authored by Piotr Jamróz
parent b56d7131bd
commit 53642b60ed
11 changed files with 166 additions and 111 deletions
-12
View File
@@ -148,18 +148,6 @@ export function buildQueryTransaction(
export const clearQueryKeys: (query: DataQuery) => DataQuery = ({ key, ...rest }) => rest;
export const safeParseJson = (text?: string): any | undefined => {
if (!text) {
return;
}
try {
return JSON.parse(text);
} catch (error) {
console.error(error);
}
};
export const safeStringifyValue = (value: unknown, space?: number) => {
if (value === undefined || value === null) {
return '';