Optimise code editor renders (#15405)

This commit is contained in:
arunvjn 2022-08-04 11:10:44 +05:30 committed by GitHub
parent 7624b91026
commit 4e5b21600d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
90 changed files with 195 additions and 197 deletions

View File

@ -249,7 +249,7 @@ describe("MultiSelect Widget Functionality", function() {
cy.openPropertyPane("multiselectwidgetv2"); cy.openPropertyPane("multiselectwidgetv2");
// set options // set options
propPane.UpdatePropertyFieldValue("Options", JSON.stringify(options)) propPane.UpdatePropertyFieldValue("Options", JSON.stringify(options));
agHelper.Escape(); agHelper.Escape();
// set default value // set default value
propPane.UpdatePropertyFieldValue( propPane.UpdatePropertyFieldValue(

View File

@ -27,7 +27,7 @@ describe("Datasource form OAuth2 client credentials related tests", function() {
}); });
it("3. Create an API with app url and save as Datasource for Authorization code details test", function() { it("3. Create an API with app url and save as Datasource for Authorization code details test", function() {
apiPage.CreateAndFillApi(testdata.appUrl, "TestOAuth") apiPage.CreateAndFillApi(testdata.appUrl, "TestOAuth");
agHelper.GetNClick(apiPage._saveAsDS); agHelper.GetNClick(apiPage._saveAsDS);
agHelper.ValidateToastMessage("datasource created"); //verifying there is no error toast, Bug 14566 agHelper.ValidateToastMessage("datasource created"); //verifying there is no error toast, Bug 14566
}); });

View File

@ -495,7 +495,7 @@ Cypress.Commands.add("updateCodeInput", ($selector, value) => {
input.focus(); input.focus();
cy.wait(200); cy.wait(200);
input.setValue(value); input.setValue(value);
cy.wait(200); //time for value to set cy.wait(1000); //time for value to set
//input.focus(); //input.focus();
}); });
}); });

View File

@ -1,6 +1,6 @@
import axios, { AxiosInstance, AxiosRequestConfig } from "axios"; import axios, { AxiosInstance, AxiosRequestConfig } from "axios";
import { REQUEST_TIMEOUT_MS } from "@appsmith/constants/ApiConstants"; import { REQUEST_TIMEOUT_MS } from "@appsmith/constants/ApiConstants";
import { convertObjectToQueryParams } from "utils/AppsmithUtils"; import { convertObjectToQueryParams } from "utils/URLUtils";
import { import {
apiFailureResponseInterceptor, apiFailureResponseInterceptor,
apiRequestInterceptor, apiRequestInterceptor,

View File

@ -3,7 +3,7 @@ import {
ReduxActionErrorTypes, ReduxActionErrorTypes,
ReduxActionTypes, ReduxActionTypes,
} from "@appsmith/constants/ReduxActionConstants"; } from "@appsmith/constants/ReduxActionConstants";
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
export const initialState: SettingsReduxState = { export const initialState: SettingsReduxState = {
isLoading: false, isLoading: false,

View File

@ -7,7 +7,7 @@ import PerformanceTracker, {
PerformanceTransactionName, PerformanceTransactionName,
} from "utils/PerformanceTracker"; } from "utils/PerformanceTracker";
import { INTEGRATION_TABS } from "constants/routes"; import { INTEGRATION_TABS } from "constants/routes";
import { getQueryParams } from "utils/AppsmithUtils"; import { getQueryParams } from "utils/URLUtils";
import { getIsGeneratePageInitiator } from "utils/GenerateCrudUtil"; import { getIsGeneratePageInitiator } from "utils/GenerateCrudUtil";
import { import {
builderURL, builderURL,

View File

@ -102,8 +102,8 @@ import { interactionAnalyticsEvent } from "utils/AppsmithUtils";
import { AdditionalDynamicDataTree } from "utils/autocomplete/customTreeTypeDefCreator"; import { AdditionalDynamicDataTree } from "utils/autocomplete/customTreeTypeDefCreator";
interface ReduxStateProps { interface ReduxStateProps {
dynamicData: DataTree;
datasources: any; datasources: any;
dynamicData: DataTree;
pluginIdToImageLocation: Record<string, string>; pluginIdToImageLocation: Record<string, string>;
recentEntities: string[]; recentEntities: string[];
} }
@ -353,9 +353,15 @@ class CodeEditor extends Component<Props, State> {
window.addEventListener("keydown", this.handleKeydown); window.addEventListener("keydown", this.handleKeydown);
} }
shouldComponentUpdate(nextProps: Props, nextState: State) {
if (this.props.dynamicData !== nextProps.dynamicData)
return nextState.isFocused || !!nextProps.isJSObject;
return true;
}
componentDidUpdate(prevProps: Props): void { componentDidUpdate(prevProps: Props): void {
this.editor.operation(() => { this.editor.operation(() => {
if (!this.state.isFocused) { if (this.state.isFocused) return;
// const currentMode = this.editor.getOption("mode"); // const currentMode = this.editor.getOption("mode");
const editorValue = this.editor.getValue(); const editorValue = this.editor.getValue();
// Safe update of value of the editor when value updated outside the editor // Safe update of value of the editor when value updated outside the editor
@ -376,14 +382,6 @@ class CodeEditor extends Component<Props, State> {
this.editor.setValue(""); this.editor.setValue("");
} }
CodeEditor.updateMarkings(this.editor, this.props.marking); CodeEditor.updateMarkings(this.editor, this.props.marking);
} else {
// Update the dynamic bindings for autocomplete
if (prevProps.dynamicData !== this.props.dynamicData) {
this.hinters.forEach(
(hinter) => hinter.update && hinter.update(this.props.dynamicData),
);
}
}
}); });
} }
@ -757,7 +755,6 @@ class CodeEditor extends Component<Props, State> {
} }
getPropertyValidation = ( getPropertyValidation = (
dataTree: DataTree,
dataTreePath?: string, dataTreePath?: string,
): { ): {
isInvalid: boolean; isInvalid: boolean;
@ -773,7 +770,7 @@ class CodeEditor extends Component<Props, State> {
} }
const errors = _.get( const errors = _.get(
dataTree, this.props.dynamicData,
getEvalErrorPath(dataTreePath), getEvalErrorPath(dataTreePath),
[], [],
) as EvaluationError[]; ) as EvaluationError[];
@ -792,7 +789,10 @@ class CodeEditor extends Component<Props, State> {
this.state.hasLintError && this.setState({ hasLintError: false }); this.state.hasLintError && this.setState({ hasLintError: false });
} }
const pathEvaluatedValue = _.get(dataTree, getEvalValuePath(dataTreePath)); const pathEvaluatedValue = _.get(
this.props.dynamicData,
getEvalValuePath(dataTreePath),
);
return { return {
isInvalid: filteredLintErrors.length > 0, isInvalid: filteredLintErrors.length > 0,
@ -809,7 +809,6 @@ class CodeEditor extends Component<Props, State> {
codeEditorVisibleOverflow, codeEditorVisibleOverflow,
dataTreePath, dataTreePath,
disabled, disabled,
dynamicData,
evaluatedValue, evaluatedValue,
evaluationSubstitutionType, evaluationSubstitutionType,
expected, expected,
@ -823,14 +822,14 @@ class CodeEditor extends Component<Props, State> {
theme, theme,
useValidationMessage, useValidationMessage,
} = this.props; } = this.props;
const validations = this.getPropertyValidation(dynamicData, dataTreePath);
const validations = this.getPropertyValidation(dataTreePath);
let { errors, isInvalid } = validations; let { errors, isInvalid } = validations;
const { pathEvaluatedValue } = validations; const { pathEvaluatedValue } = validations;
let evaluated = evaluatedValue; let evaluated = evaluatedValue;
if (dataTreePath) { if (dataTreePath) {
evaluated = pathEvaluatedValue; evaluated = pathEvaluatedValue;
} }
const entityInformation = this.getEntityInformation(); const entityInformation = this.getEntityInformation();
/* Evaluation results for snippet arguments. The props below can be used to set the validation errors when computed from parent component */ /* Evaluation results for snippet arguments. The props below can be used to set the validation errors when computed from parent component */
if (this.props.errors) { if (this.props.errors) {
@ -840,7 +839,6 @@ class CodeEditor extends Component<Props, State> {
isInvalid = Boolean(this.props.isInvalid); isInvalid = Boolean(this.props.isInvalid);
} }
/* Evaluation results for snippet snippets */ /* Evaluation results for snippet snippets */
this.lintCode(this.editor); this.lintCode(this.editor);
const showEvaluatedValue = const showEvaluatedValue =

View File

@ -17,7 +17,7 @@ import {
import { getSelectedWidget } from "selectors/ui"; import { getSelectedWidget } from "selectors/ui";
import AnalyticsUtil from "utils/AnalyticsUtil"; import AnalyticsUtil from "utils/AnalyticsUtil";
import history from "utils/history"; import history from "utils/history";
import { getQueryParams } from "utils/AppsmithUtils"; import { getQueryParams } from "utils/URLUtils";
import { datasourcesEditorIdURL, jsCollectionIdURL } from "RouteBuilder"; import { datasourcesEditorIdURL, jsCollectionIdURL } from "RouteBuilder";
function ActionLink(props: EntityLinkProps) { function ActionLink(props: EntityLinkProps) {

View File

@ -57,7 +57,7 @@ import AnalyticsUtil from "utils/AnalyticsUtil";
import useRecentEntities from "./useRecentEntities"; import useRecentEntities from "./useRecentEntities";
import { get, noop } from "lodash"; import { get, noop } from "lodash";
import { getCurrentPageId } from "selectors/editorSelectors"; import { getCurrentPageId } from "selectors/editorSelectors";
import { getQueryParams } from "utils/AppsmithUtils"; import { getQueryParams } from "utils/URLUtils";
import SnippetsFilter from "./SnippetsFilter"; import SnippetsFilter from "./SnippetsFilter";
import SnippetRefinements from "./SnippetRefinements"; import SnippetRefinements from "./SnippetRefinements";
import { Configure, Index } from "react-instantsearch-dom"; import { Configure, Index } from "react-instantsearch-dom";

View File

@ -20,7 +20,7 @@ import { CurlIconV2, JsFileIconV2 } from "pages/Editor/Explorer/ExplorerIcons";
import { createNewApiAction } from "actions/apiPaneActions"; import { createNewApiAction } from "actions/apiPaneActions";
import { createNewJSCollection } from "actions/jsPaneActions"; import { createNewJSCollection } from "actions/jsPaneActions";
import { EventLocation } from "utils/AnalyticsUtil"; import { EventLocation } from "utils/AnalyticsUtil";
import { getQueryParams } from "utils/AppsmithUtils"; import { getQueryParams } from "utils/URLUtils";
import history from "utils/history"; import history from "utils/history";
import { curlImportPageURL } from "RouteBuilder"; import { curlImportPageURL } from "RouteBuilder";
import { isMacOrIOS, modText, shiftText } from "utils/helpers"; import { isMacOrIOS, modText, shiftText } from "utils/helpers";

View File

@ -41,7 +41,7 @@ import { Text, FontWeight, TextType } from "design-system";
import history from "utils/history"; import history from "utils/history";
import { getDatasourceInfo } from "pages/Editor/APIEditor/ApiRightPane"; import { getDatasourceInfo } from "pages/Editor/APIEditor/ApiRightPane";
import * as FontFamilies from "constants/Fonts"; import * as FontFamilies from "constants/Fonts";
import { getQueryParams } from "utils/AppsmithUtils"; import { getQueryParams } from "utils/URLUtils";
import { AuthType } from "entities/Datasource/RestAPIForm"; import { AuthType } from "entities/Datasource/RestAPIForm";
import { setDatsourceEditorMode } from "actions/datasourceActions"; import { setDatsourceEditorMode } from "actions/datasourceActions";

View File

@ -16,10 +16,7 @@ import TemplateMenu from "pages/Editor/QueryEditor/TemplateMenu";
import { QUERY_BODY_FIELD } from "constants/QueryEditorConstants"; import { QUERY_BODY_FIELD } from "constants/QueryEditorConstants";
import { getPluginResponseTypes } from "selectors/entitiesSelector"; import { getPluginResponseTypes } from "selectors/entitiesSelector";
import history from "utils/history"; import history from "utils/history";
import { import { convertObjectToQueryParams, getQueryParams } from "utils/URLUtils";
convertObjectToQueryParams,
getQueryParams,
} from "utils/AppsmithUtils";
import { actionPathFromName } from "components/formControls/utils"; import { actionPathFromName } from "components/formControls/utils";
import { EvaluationSubstitutionType } from "entities/DataTree/dataTreeFactory"; import { EvaluationSubstitutionType } from "entities/DataTree/dataTreeFactory";

View File

@ -1,5 +1,5 @@
export * from "ce/reducers/settingsReducer"; export * from "ce/reducers/settingsReducer";
import { handlers, initialState } from "ce/reducers/settingsReducer"; import { handlers, initialState } from "ce/reducers/settingsReducer";
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
export default createReducer(initialState, handlers); export default createReducer(initialState, handlers);

View File

@ -4,7 +4,7 @@ import ReactDOM from "react-dom";
import { Provider } from "react-redux"; import { Provider } from "react-redux";
import "./index.css"; import "./index.css";
import { ThemeProvider } from "constants/DefaultTheme"; import { ThemeProvider } from "constants/DefaultTheme";
import { appInitializer } from "utils/AppsmithUtils"; import { appInitializer } from "utils/AppUtils";
import { Slide } from "react-toastify"; import { Slide } from "react-toastify";
import store from "./store"; import store from "./store";
import { LayersContext, Layers } from "constants/Layers"; import { LayersContext, Layers } from "constants/Layers";

View File

@ -9,7 +9,7 @@ import {
storeAsDatasource, storeAsDatasource,
} from "actions/datasourceActions"; } from "actions/datasourceActions";
import history from "utils/history"; import history from "utils/history";
import { getQueryParams } from "utils/AppsmithUtils"; import { getQueryParams } from "utils/URLUtils";
import { Text, TextType } from "design-system"; import { Text, TextType } from "design-system";
import { AuthType } from "entities/Datasource/RestAPIForm"; import { AuthType } from "entities/Datasource/RestAPIForm";
import { API_EDITOR_FORM_NAME } from "constants/forms"; import { API_EDITOR_FORM_NAME } from "constants/forms";

View File

@ -7,7 +7,7 @@ import { TabComponent } from "components/ads/Tabs";
import { Text, FontWeight, TextType } from "design-system"; import { Text, FontWeight, TextType } from "design-system";
import { TabbedViewContainer } from "./Form"; import { TabbedViewContainer } from "./Form";
import get from "lodash/get"; import get from "lodash/get";
import { getQueryParams } from "utils/AppsmithUtils"; import { getQueryParams } from "utils/URLUtils";
import ActionRightPane, { import ActionRightPane, {
useEntityDependencies, useEntityDependencies,
} from "components/editorComponents/ActionRightPane"; } from "components/editorComponents/ActionRightPane";

View File

@ -16,7 +16,7 @@ import { useDispatch, useSelector } from "react-redux";
import { AppState } from "reducers"; import { AppState } from "reducers";
import { DatasourceStructureContainer } from "./DatasourceStructureContainer"; import { DatasourceStructureContainer } from "./DatasourceStructureContainer";
import { isStoredDatasource, PluginType } from "entities/Action"; import { isStoredDatasource, PluginType } from "entities/Action";
import { getQueryParams } from "utils/AppsmithUtils"; import { getQueryParams } from "utils/URLUtils";
import { getAction } from "selectors/entitiesSelector"; import { getAction } from "selectors/entitiesSelector";
import { import {
datasourcesEditorIdURL, datasourcesEditorIdURL,

View File

@ -20,7 +20,7 @@ import { useParams, useLocation } from "react-router";
import { ExplorerURLParams } from "../../../Explorer/helpers"; import { ExplorerURLParams } from "../../../Explorer/helpers";
import { INTEGRATION_TABS } from "constants/routes"; import { INTEGRATION_TABS } from "constants/routes";
import history from "utils/history"; import history from "utils/history";
import { getQueryParams } from "utils/AppsmithUtils"; import { getQueryParams } from "utils/URLUtils";
import { getIsGeneratingTemplatePage } from "selectors/pageListSelectors"; import { getIsGeneratingTemplatePage } from "selectors/pageListSelectors";
import DataSourceOption from "../DataSourceOption"; import DataSourceOption from "../DataSourceOption";
import { getQueryStringfromObject } from "RouteBuilder"; import { getQueryStringfromObject } from "RouteBuilder";

View File

@ -7,7 +7,7 @@ import {
getPostWelcomeTourState, getPostWelcomeTourState,
setPostWelcomeTourState, setPostWelcomeTourState,
} from "utils/storage"; } from "utils/storage";
import { getQueryParams } from "utils/AppsmithUtils"; import { getQueryParams } from "utils/URLUtils";
import { useDispatch } from "react-redux"; import { useDispatch } from "react-redux";
import { showPostCompletionMessage } from "actions/onboardingActions"; import { showPostCompletionMessage } from "actions/onboardingActions";
import AnalyticsUtil from "utils/AnalyticsUtil"; import AnalyticsUtil from "utils/AnalyticsUtil";

View File

@ -17,7 +17,7 @@ import { Position } from "@blueprintjs/core/lib/esm/common/position";
import { renderDatasourceSection } from "pages/Editor/DataSourceEditor/DatasourceSection"; import { renderDatasourceSection } from "pages/Editor/DataSourceEditor/DatasourceSection";
import { setDatsourceEditorMode } from "actions/datasourceActions"; import { setDatsourceEditorMode } from "actions/datasourceActions";
import { getQueryParams } from "utils/AppsmithUtils"; import { getQueryParams } from "utils/URLUtils";
import Menu from "components/ads/Menu"; import Menu from "components/ads/Menu";
import Icon, { IconSize } from "components/ads/Icon"; import Icon, { IconSize } from "components/ads/Icon";
import MenuItem from "components/ads/MenuItem"; import MenuItem from "components/ads/MenuItem";

View File

@ -11,7 +11,7 @@ import AnalyticsUtil from "utils/AnalyticsUtil";
import { getCurrentApplication } from "selectors/applicationSelectors"; import { getCurrentApplication } from "selectors/applicationSelectors";
import { ApplicationPayload } from "@appsmith/constants/ReduxActionConstants"; import { ApplicationPayload } from "@appsmith/constants/ReduxActionConstants";
import { Colors } from "constants/Colors"; import { Colors } from "constants/Colors";
import { getQueryParams } from "utils/AppsmithUtils"; import { getQueryParams } from "utils/URLUtils";
import { getGenerateCRUDEnabledPluginMap } from "selectors/entitiesSelector"; import { getGenerateCRUDEnabledPluginMap } from "selectors/entitiesSelector";
import { GenerateCRUDEnabledPluginMap } from "api/PluginApi"; import { GenerateCRUDEnabledPluginMap } from "api/PluginApi";
import { getIsGeneratePageInitiator } from "utils/GenerateCrudUtil"; import { getIsGeneratePageInitiator } from "utils/GenerateCrudUtil";

View File

@ -20,7 +20,7 @@ import { INTEGRATION_TABS, INTEGRATION_EDITOR_MODES } from "constants/routes";
import { thinScrollbar } from "constants/DefaultTheme"; import { thinScrollbar } from "constants/DefaultTheme";
import BackButton from "../DataSourceEditor/BackButton"; import BackButton from "../DataSourceEditor/BackButton";
import UnsupportedPluginDialog from "./UnsupportedPluginDialog"; import UnsupportedPluginDialog from "./UnsupportedPluginDialog";
import { getQueryParams } from "utils/AppsmithUtils"; import { getQueryParams } from "utils/URLUtils";
import { getIsGeneratePageInitiator } from "utils/GenerateCrudUtil"; import { getIsGeneratePageInitiator } from "utils/GenerateCrudUtil";
import { getCurrentApplicationId } from "selectors/editorSelectors"; import { getCurrentApplicationId } from "selectors/editorSelectors";
import { integrationEditorURL } from "RouteBuilder"; import { integrationEditorURL } from "RouteBuilder";

View File

@ -6,7 +6,7 @@ import { getPluginImages } from "selectors/entitiesSelector";
import { Colors } from "constants/Colors"; import { Colors } from "constants/Colors";
import { addMockDatasourceToWorkspace } from "actions/datasourceActions"; import { addMockDatasourceToWorkspace } from "actions/datasourceActions";
import { getCurrentWorkspaceId } from "@appsmith/selectors/workspaceSelectors"; import { getCurrentWorkspaceId } from "@appsmith/selectors/workspaceSelectors";
import { getQueryParams } from "utils/AppsmithUtils"; import { getQueryParams } from "utils/URLUtils";
import { AppState } from "reducers"; import { AppState } from "reducers";
import AnalyticsUtil from "utils/AnalyticsUtil"; import AnalyticsUtil from "utils/AnalyticsUtil";

View File

@ -12,7 +12,7 @@ import AnalyticsUtil, { EventLocation } from "utils/AnalyticsUtil";
import { CURL } from "constants/AppsmithActionConstants/ActionConstants"; import { CURL } from "constants/AppsmithActionConstants/ActionConstants";
import { PluginType } from "entities/Action"; import { PluginType } from "entities/Action";
import { Spinner } from "@blueprintjs/core"; import { Spinner } from "@blueprintjs/core";
import { getQueryParams } from "utils/AppsmithUtils"; import { getQueryParams } from "utils/URLUtils";
import { GenerateCRUDEnabledPluginMap } from "api/PluginApi"; import { GenerateCRUDEnabledPluginMap } from "api/PluginApi";
import { getGenerateCRUDEnabledPluginMap } from "selectors/entitiesSelector"; import { getGenerateCRUDEnabledPluginMap } from "selectors/entitiesSelector";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";

View File

@ -20,7 +20,7 @@ import {
} from "actions/datasourceActions"; } from "actions/datasourceActions";
import AnalyticsUtil from "utils/AnalyticsUtil"; import AnalyticsUtil from "utils/AnalyticsUtil";
import { redirectToNewIntegrations } from "actions/apiPaneActions"; import { redirectToNewIntegrations } from "actions/apiPaneActions";
import { getQueryParams } from "utils/AppsmithUtils"; import { getQueryParams } from "utils/URLUtils";
import { getCurrentApplicationId } from "selectors/editorSelectors"; import { getCurrentApplicationId } from "selectors/editorSelectors";
import { useParams, useLocation } from "react-router"; import { useParams, useLocation } from "react-router";
import { ExplorerURLParams } from "pages/Editor/Explorer/helpers"; import { ExplorerURLParams } from "pages/Editor/Explorer/helpers";

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxActionTypes, ReduxActionTypes,
ReduxAction, ReduxAction,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createImmerReducer } from "utils/AppsmithUtils"; import { createImmerReducer } from "utils/ReducerUtils";
import { import {
ReduxActionTypes, ReduxActionTypes,
UpdateCanvasPayload, UpdateCanvasPayload,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxActionTypes, ReduxActionTypes,
ReduxAction, ReduxAction,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { JSAction, JSCollection } from "entities/JSCollection"; import { JSAction, JSCollection } from "entities/JSCollection";
import { import {
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxActionErrorTypes, ReduxActionErrorTypes,
ReduxAction, ReduxAction,

View File

@ -1,5 +1,5 @@
import { set } from "lodash"; import { set } from "lodash";
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
UpdateWidgetMetaPropertyPayload, UpdateWidgetMetaPropertyPayload,
ResetWidgetMetaPayload, ResetWidgetMetaPayload,

View File

@ -6,7 +6,7 @@ import {
ClonePageSuccessPayload, ClonePageSuccessPayload,
ReduxActionErrorTypes, ReduxActionErrorTypes,
} from "@appsmith/constants/ReduxActionConstants"; } from "@appsmith/constants/ReduxActionConstants";
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { GenerateCRUDSuccess } from "actions/pageActions"; import { GenerateCRUDSuccess } from "actions/pageActions";
const initialState: PageListReduxState = { const initialState: PageListReduxState = {

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxActionTypes, ReduxActionTypes,
ReduxAction, ReduxAction,

View File

@ -1,4 +1,4 @@
import { createImmerReducer } from "utils/AppsmithUtils"; import { createImmerReducer } from "utils/ReducerUtils";
import { import {
ReduxActionTypes, ReduxActionTypes,
ReduxAction, ReduxAction,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -4,7 +4,7 @@ import {
} from "@appsmith/constants/ReduxActionConstants"; } from "@appsmith/constants/ReduxActionConstants";
import { applyChange, Diff } from "deep-diff"; import { applyChange, Diff } from "deep-diff";
import { DataTree } from "entities/DataTree/dataTreeFactory"; import { DataTree } from "entities/DataTree/dataTreeFactory";
import { createImmerReducer } from "utils/AppsmithUtils"; import { createImmerReducer } from "utils/ReducerUtils";
import * as Sentry from "@sentry/react"; import * as Sentry from "@sentry/react";
export type EvaluatedTreeState = DataTree; export type EvaluatedTreeState = DataTree;

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxActionTypes, ReduxActionTypes,
ReduxActionErrorTypes, ReduxActionErrorTypes,

View File

@ -2,7 +2,7 @@ import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,
} from "@appsmith/constants/ReduxActionConstants"; } from "@appsmith/constants/ReduxActionConstants";
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { User } from "entities/AppCollab/CollabInterfaces"; import { User } from "entities/AppCollab/CollabInterfaces";
import { cloneDeep } from "lodash"; import { cloneDeep } from "lodash";

View File

@ -1,6 +1,6 @@
import { AppTheme } from "entities/AppTheming"; import { AppTheme } from "entities/AppTheming";
import { AppThemingMode } from "selectors/appThemingSelectors"; import { AppThemingMode } from "selectors/appThemingSelectors";
import { createImmerReducer } from "utils/AppsmithUtils"; import { createImmerReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxActionTypes, ReduxActionTypes,
ReduxActionErrorTypes, ReduxActionErrorTypes,

View File

@ -1,4 +1,4 @@
import { createImmerReducer } from "utils/AppsmithUtils"; import { createImmerReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxActionTypes, ReduxActionTypes,
ReduxAction, ReduxAction,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { Log } from "entities/AppsmithConsole"; import { Log } from "entities/AppsmithConsole";
import { import {
ReduxAction, ReduxAction,

View File

@ -1,4 +1,4 @@
import { createImmerReducer } from "utils/AppsmithUtils"; import { createImmerReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
UpdateCanvasPayload, UpdateCanvasPayload,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionErrorTypes, ReduxActionErrorTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxActionTypes, ReduxActionTypes,
ReduxAction, ReduxAction,

View File

@ -1,4 +1,4 @@
import { createImmerReducer } from "utils/AppsmithUtils"; import { createImmerReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -2,7 +2,7 @@ import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,
} from "@appsmith/constants/ReduxActionConstants"; } from "@appsmith/constants/ReduxActionConstants";
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
const initialState: OnboardingState = { const initialState: OnboardingState = {
// Signposting // Signposting

View File

@ -1,4 +1,4 @@
import { createImmerReducer } from "utils/AppsmithUtils"; import { createImmerReducer } from "utils/ReducerUtils";
import { import {
ReduxActionTypes, ReduxActionTypes,
ReduxActionErrorTypes, ReduxActionErrorTypes,

View File

@ -1,4 +1,4 @@
import { createImmerReducer } from "utils/AppsmithUtils"; import { createImmerReducer } from "utils/ReducerUtils";
import { import {
ReduxActionTypes, ReduxActionTypes,
ReduxAction, ReduxAction,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxActionTypes, ReduxActionTypes,
ReduxAction, ReduxAction,

View File

@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/ban-types */ /* eslint-disable @typescript-eslint/ban-types */
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxActionTypes, ReduxActionTypes,
ReduxActionErrorTypes, ReduxActionErrorTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReflowReduxActionTypes, ReflowReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxActionTypes, ReduxActionTypes,
ReduxAction, ReduxAction,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionErrorTypes, ReduxActionErrorTypes,

View File

@ -1,4 +1,4 @@
import { createImmerReducer } from "utils/AppsmithUtils"; import { createImmerReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,5 +1,5 @@
import _ from "lodash"; import _ from "lodash";
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createReducer } from "utils/AppsmithUtils"; import { createReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -1,4 +1,4 @@
import { createImmerReducer } from "utils/AppsmithUtils"; import { createImmerReducer } from "utils/ReducerUtils";
import { import {
ReduxAction, ReduxAction,
ReduxActionTypes, ReduxActionTypes,

View File

@ -86,11 +86,8 @@ import AppsmithConsole from "utils/AppsmithConsole";
import { ENTITY_TYPE } from "entities/AppsmithConsole"; import { ENTITY_TYPE } from "entities/AppsmithConsole";
import LOG_TYPE from "entities/AppsmithConsole/logtype"; import LOG_TYPE from "entities/AppsmithConsole/logtype";
import { createNewApiAction } from "actions/apiPaneActions"; import { createNewApiAction } from "actions/apiPaneActions";
import { import { createNewApiName, createNewQueryName } from "utils/AppsmithUtils";
createNewApiName, import { getQueryParams } from "utils/URLUtils";
createNewQueryName,
getQueryParams,
} from "utils/AppsmithUtils";
import { DEFAULT_API_ACTION_CONFIG } from "constants/ApiEditorConstants"; import { DEFAULT_API_ACTION_CONFIG } from "constants/ApiEditorConstants";
import { import {
setGlobalSearchCategory, setGlobalSearchCategory,

View File

@ -29,7 +29,8 @@ import history from "utils/history";
import { INTEGRATION_EDITOR_MODES, INTEGRATION_TABS } from "constants/routes"; import { INTEGRATION_EDITOR_MODES, INTEGRATION_TABS } from "constants/routes";
import { initialize, autofill, change } from "redux-form"; import { initialize, autofill, change } from "redux-form";
import { Property } from "api/ActionAPI"; import { Property } from "api/ActionAPI";
import { createNewApiName, getQueryParams } from "utils/AppsmithUtils"; import { createNewApiName } from "utils/AppsmithUtils";
import { getQueryParams } from "utils/URLUtils";
import { getPluginIdOfPackageName } from "sagas/selectors"; import { getPluginIdOfPackageName } from "sagas/selectors";
import { getAction, getActions, getPlugin } from "selectors/entitiesSelector"; import { getAction, getActions, getPlugin } from "selectors/entitiesSelector";
import { import {

View File

@ -77,7 +77,7 @@ import { checkAndGetPluginFormConfigsSaga } from "sagas/PluginSagas";
import { PluginType } from "entities/Action"; import { PluginType } from "entities/Action";
import LOG_TYPE from "entities/AppsmithConsole/logtype"; import LOG_TYPE from "entities/AppsmithConsole/logtype";
import { isDynamicValue } from "utils/DynamicBindingUtils"; import { isDynamicValue } from "utils/DynamicBindingUtils";
import { getQueryParams } from "utils/AppsmithUtils"; import { getQueryParams } from "utils/URLUtils";
import { GenerateCRUDEnabledPluginMap } from "api/PluginApi"; import { GenerateCRUDEnabledPluginMap } from "api/PluginApi";
import { getIsGeneratePageInitiator } from "utils/GenerateCrudUtil"; import { getIsGeneratePageInitiator } from "utils/GenerateCrudUtil";
import { shouldBeDefined, trimQueryString } from "utils/helpers"; import { shouldBeDefined, trimQueryString } from "utils/helpers";

View File

@ -23,7 +23,8 @@ import {
JSCollectionData, JSCollectionData,
JSCollectionDataState, JSCollectionDataState,
} from "reducers/entityReducers/jsActionsReducer"; } from "reducers/entityReducers/jsActionsReducer";
import { createNewJSFunctionName, getQueryParams } from "utils/AppsmithUtils"; import { createNewJSFunctionName } from "utils/AppsmithUtils";
import { getQueryParams } from "utils/URLUtils";
import { JSCollection, JSAction } from "entities/JSCollection"; import { JSCollection, JSAction } from "entities/JSCollection";
import { createJSCollectionRequest } from "actions/jsActionActions"; import { createJSCollectionRequest } from "actions/jsActionActions";
import history from "utils/history"; import history from "utils/history";

View File

@ -85,7 +85,7 @@ import {
import { UrlDataState } from "reducers/entityReducers/appReducer"; import { UrlDataState } from "reducers/entityReducers/appReducer";
import { APP_MODE } from "entities/App"; import { APP_MODE } from "entities/App";
import { clearEvalCache } from "./EvaluationsSaga"; import { clearEvalCache } from "./EvaluationsSaga";
import { getQueryParams } from "utils/AppsmithUtils"; import { getQueryParams } from "utils/URLUtils";
import PerformanceTracker, { import PerformanceTracker, {
PerformanceTransactionName, PerformanceTransactionName,
} from "utils/PerformanceTracker"; } from "utils/PerformanceTracker";

View File

@ -31,7 +31,8 @@ import {
createActionRequest, createActionRequest,
setActionProperty, setActionProperty,
} from "actions/pluginActionActions"; } from "actions/pluginActionActions";
import { getNextEntityName, getQueryParams } from "utils/AppsmithUtils"; import { getNextEntityName } from "utils/AppsmithUtils";
import { getQueryParams } from "utils/URLUtils";
import { isEmpty, merge } from "lodash"; import { isEmpty, merge } from "lodash";
import { getConfigInitialValues } from "components/formControls/utils"; import { getConfigInitialValues } from "components/formControls/utils";
import { Variant } from "components/ads/common"; import { Variant } from "components/ads/common";

View File

@ -0,0 +1,22 @@
import { getAppsmithConfigs } from "ce/configs";
import FormControlRegistry from "./formControl/FormControlRegistry";
import { LogLevelDesc } from "loglevel";
import localStorage from "utils/localStorage";
import * as log from "loglevel";
export const appInitializer = () => {
FormControlRegistry.registerFormControlBuilders();
const appsmithConfigs = getAppsmithConfigs();
log.setLevel(getEnvLogLevel(appsmithConfigs.logLevel));
};
const getEnvLogLevel = (configLevel: LogLevelDesc): LogLevelDesc => {
let logLevel = configLevel;
if (localStorage && localStorage.getItem) {
const localStorageLevel = localStorage.getItem(
"logLevelOverride",
) as LogLevelDesc;
if (localStorageLevel) logLevel = localStorageLevel;
}
return logLevel;
};

View File

@ -1,53 +1,16 @@
import { ReduxAction } from "@appsmith/constants/ReduxActionConstants";
import { getAppsmithConfigs } from "@appsmith/configs"; import { getAppsmithConfigs } from "@appsmith/configs";
import * as Sentry from "@sentry/react"; import * as Sentry from "@sentry/react";
import AnalyticsUtil from "./AnalyticsUtil"; import AnalyticsUtil from "./AnalyticsUtil";
import FormControlRegistry from "./formControl/FormControlRegistry";
import { Property } from "api/ActionAPI"; import { Property } from "api/ActionAPI";
import _ from "lodash"; import _ from "lodash";
import { ActionDataState } from "reducers/entityReducers/actionsReducer"; import { ActionDataState } from "reducers/entityReducers/actionsReducer";
import * as log from "loglevel"; import * as log from "loglevel";
import { LogLevelDesc } from "loglevel";
import produce from "immer";
import { AppIconCollection, AppIconName } from "components/ads/AppIcon"; import { AppIconCollection, AppIconName } from "components/ads/AppIcon";
import { ERROR_CODES } from "@appsmith/constants/ApiConstants"; import { ERROR_CODES } from "@appsmith/constants/ApiConstants";
import { createMessage, ERROR_500 } from "@appsmith/constants/messages"; import { createMessage, ERROR_500 } from "@appsmith/constants/messages";
import localStorage from "utils/localStorage";
import { JSCollectionData } from "reducers/entityReducers/jsActionsReducer"; import { JSCollectionData } from "reducers/entityReducers/jsActionsReducer";
import { osName } from "react-device-detect"; import { osName } from "react-device-detect";
export const createReducer = (
initialState: any,
handlers: { [type: string]: (state: any, action: any) => any },
) => {
return function reducer(state = initialState, action: ReduxAction<any>) {
if (handlers.hasOwnProperty(action.type)) {
return handlers[action.type](state, action);
} else {
return state;
}
};
};
export const createImmerReducer = (
initialState: any,
handlers: { [type: string]: any },
) => {
return function reducer(state = initialState, action: ReduxAction<any>) {
if (handlers.hasOwnProperty(action.type)) {
return produce(handlers[action.type])(state, action);
} else {
return state;
}
};
};
export const appInitializer = () => {
FormControlRegistry.registerFormControlBuilders();
const appsmithConfigs = getAppsmithConfigs();
log.setLevel(getEnvLogLevel(appsmithConfigs.logLevel));
};
export const initializeAnalyticsAndTrackers = () => { export const initializeAnalyticsAndTrackers = () => {
const appsmithConfigs = getAppsmithConfigs(); const appsmithConfigs = getAppsmithConfigs();
@ -255,17 +218,6 @@ export const convertToString = (value: any): string => {
return value.toString(); return value.toString();
}; };
const getEnvLogLevel = (configLevel: LogLevelDesc): LogLevelDesc => {
let logLevel = configLevel;
if (localStorage && localStorage.getItem) {
const localStorageLevel = localStorage.getItem(
"logLevelOverride",
) as LogLevelDesc;
if (localStorageLevel) logLevel = localStorageLevel;
}
return logLevel;
};
export const getInitialsAndColorCode = ( export const getInitialsAndColorCode = (
fullName: any, fullName: any,
colorPalette: string[], colorPalette: string[],
@ -329,29 +281,6 @@ export function hexToRgb(
}; };
} }
export function getQueryParams() {
const urlParams = new URLSearchParams(window.location.search);
const keys = urlParams.keys();
let key = keys.next().value;
const queryParams: Record<string, string> = {};
while (key) {
queryParams[key] = urlParams.get(key) as string;
key = keys.next().value;
}
return queryParams;
}
export function convertObjectToQueryParams(object: any): string {
if (!_.isNil(object)) {
const paramArray: string[] = _.map(_.keys(object), (key) => {
return encodeURIComponent(key) + "=" + encodeURIComponent(object[key]);
});
return "?" + _.join(paramArray, "&");
} else {
return "";
}
}
export const retryPromise = ( export const retryPromise = (
fn: () => Promise<any>, fn: () => Promise<any>,
retriesLeft = 5, retriesLeft = 5,

View File

@ -0,0 +1,28 @@
import { ReduxAction } from "@appsmith/constants/ReduxActionConstants";
import produce from "immer";
export const createReducer = (
initialState: any,
handlers: { [type: string]: (state: any, action: any) => any },
) => {
return function reducer(state = initialState, action: ReduxAction<any>) {
if (handlers.hasOwnProperty(action.type)) {
return handlers[action.type](state, action);
} else {
return state;
}
};
};
export const createImmerReducer = (
initialState: any,
handlers: { [type: string]: any },
) => {
return function reducer(state = initialState, action: ReduxAction<any>) {
if (handlers.hasOwnProperty(action.type)) {
return produce(handlers[action.type])(state, action);
} else {
return state;
}
};
};

View File

@ -0,0 +1,24 @@
import _ from "lodash";
export function getQueryParams() {
const urlParams = new URLSearchParams(window.location.search);
const keys = urlParams.keys();
let key = keys.next().value;
const queryParams: Record<string, string> = {};
while (key) {
queryParams[key] = urlParams.get(key) as string;
key = keys.next().value;
}
return queryParams;
}
export function convertObjectToQueryParams(object: any): string {
if (!_.isNil(object)) {
const paramArray: string[] = _.map(_.keys(object), (key) => {
return encodeURIComponent(key) + "=" + encodeURIComponent(object[key]);
});
return "?" + _.join(paramArray, "&");
} else {
return "";
}
}