Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: appsmith.URL.queryParams update on same page navigation #32382

Merged
merged 3 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { WIDGETSKIT } from "../../../../locators/WidgetLocators";
import {
agHelper,
dataSources,
Expand All @@ -10,16 +11,17 @@ import {
import EditorNavigation, {
EntityType,
} from "../../../../support/Pages/EditorNavigation";
import PageList from "../../../../support/Pages/PageList";

describe("Navigate To feature", { tags: ["@tag.JS"] }, () => {
it("1. Navigates to page name clicked from the page name tab of navigate to", () => {
PageList.AddNewPage(); // page 2
EditorNavigation.SelectEntityByName("Page1", EntityType.Page);
entityExplorer.DragDropWidgetNVerify(draggableWidgets.TEXT, 500, 600);
EditorNavigation.SelectEntityByName("Text1", EntityType.Widget);
propPane.TypeTextIntoField("Text", "{{appsmith.URL.queryParams.test}}");
entityExplorer.DragDropWidgetNVerify(draggableWidgets.BUTTON, 300, 300);
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget);
propPane.SelectPlatformFunction("onClick", "Navigate to");
dataSources.ValidateNSelectDropdown("Choose page", "Select page", "Page2");
dataSources.ValidateNSelectDropdown("Choose page", "Select page", "Page1");
rishabhrathod01 marked this conversation as resolved.
Show resolved Hide resolved
propPane.UpdatePropertyFieldValue(
"Query params",
`{{
Expand All @@ -30,21 +32,23 @@ describe("Navigate To feature", { tags: ["@tag.JS"] }, () => {
);
agHelper.GetNClick(propPane._actionSelectorPopupClose);
agHelper.ClickButton("Submit");

agHelper.GetNAssertElementText(
WIDGETSKIT.textWidgetContainer,
"123",
"have.text",
0,
);

cy.url().should("include", "a=b").and("include", "test=123");
EditorNavigation.SelectEntityByName("Page1", EntityType.Page);
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.BUTTON));
agHelper.WaitUntilEleAppear(
locators._widgetInDeployed(draggableWidgets.BUTTON),
);
agHelper.ClickButton("Submit");
agHelper.GetNAssertContains(
locators._emptyPageTxt,
"This page seems to be blank",
);
cy.url().then(($url) => {
cy.log("deploy url is" + $url);
expect($url).to.contain("test=123");
});
//cy.location().its('href').should('include', 'test=123')//both are same
});
});
1 change: 0 additions & 1 deletion app/client/src/ce/actions/evaluationActionsList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ export const EVALUATE_REDUX_ACTIONS = [
ReduxActionTypes.UPDATE_SELECTED_APP_THEME_SUCCESS,
ReduxActionTypes.CHANGE_SELECTED_APP_THEME_SUCCESS,
ReduxActionTypes.SET_PREVIEW_APP_THEME,

// Custom Library
ReduxActionTypes.INSTALL_LIBRARY_SUCCESS,
ReduxActionTypes.UNINSTALL_LIBRARY_SUCCESS,
Expand Down
11 changes: 9 additions & 2 deletions app/client/src/sagas/ActionExecution/NavigateActionSaga.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { call, select } from "redux-saga/effects";
import { call, put, select } from "redux-saga/effects";
import { getCurrentPageId, getPageList } from "selectors/editorSelectors";
import _ from "lodash";
import type { Page } from "@appsmith/constants/ReduxActionConstants";
import {
ReduxActionTypes,
type Page,
} from "@appsmith/constants/ReduxActionConstants";
import AnalyticsUtil from "utils/AnalyticsUtil";
import { getAppMode } from "@appsmith/selectors/applicationSelectors";
import { APP_MODE } from "entities/App";
Expand Down Expand Up @@ -58,6 +61,9 @@ export default function* navigateActionSaga(action: TNavigateToDescription) {
history.push(path);
if (currentPageId === page.pageId) {
yield call(setDataUrl);
yield put({
type: ReduxActionTypes.TRIGGER_EVAL,
});
}
} else if (target === NavigationTargetType.NEW_WINDOW) {
window.open(path, "_blank");
Expand Down Expand Up @@ -88,6 +94,7 @@ export default function* navigateActionSaga(action: TNavigateToDescription) {
} else if (target === NavigationTargetType.NEW_WINDOW) {
window.open(url, "_blank");
}

AppsmithConsole.info({
text: `navigateTo('${url}') was triggered`,
state: {
Expand Down
Loading