This PR contains changes to retain context on the following items, Leaving and then returning to a page should maintain what api/query was open Entity explorer should stay as you left it when you left the page (collapse levels) Widget/explorer tab Width - Should be the same across all pages of an app Property Pane width Complex widgets, multi tier property panes Co-authored-by: hetunandu <hetunandu@gmail.com> Co-authored-by: Akash N <akash@codemonk.in> Co-authored-by: Hetu Nandu <hetu@appsmith.com> Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
27 lines
595 B
TypeScript
27 lines
595 B
TypeScript
import log from "loglevel";
|
|
|
|
/**
|
|
* get query params object
|
|
* ref: https://stackoverflow.com/a/8649003/1543567
|
|
*/
|
|
export const getQueryParamsFromString = (search: string | undefined) => {
|
|
if (!search) return {};
|
|
try {
|
|
return JSON.parse(
|
|
'{"' +
|
|
decodeURI(search)
|
|
.replace(/"/g, '\\"')
|
|
.replace(/&/g, '","')
|
|
.replace(/=/g, '":"') +
|
|
'"}',
|
|
);
|
|
} catch (e) {
|
|
log.error(e, "error parsing search string");
|
|
return {};
|
|
}
|
|
};
|
|
|
|
export default function() {
|
|
return getQueryParamsFromString(window.location.search.substring(1));
|
|
}
|