## Description Widget selection is driven by URL changes. This would fix browser navigation for users as they can use browser back/forward buttons to travel across older contexts on Appsmith. > Fixing browser URL navigation for widgets Fixes #19571 Media > A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video ## Type of change > Please delete options that are not relevant. - New feature (non-breaking change which adds functionality) ## How Has This Been Tested? - Manual - Jest - Cypress ### Test Plan > Add Testsmith [test cases](https://github.com/appsmithorg/TestSmith/issues/2171) links that relate to this PR ### Issues raised during DP testing - [X] When a selected widget is below viewport and user refreshes the page, then the widget property pane is open but the page does not navigate to the selected widget https://loom.com/share/09f1eda2f02d474981a0d48e4a6419ec - [ ] Drop 2 widgets one at a time > Delete both the widgets > Now click on back button of the browser > Observe the url it shows the widget id in the URL but the canvas remains empty https://loom.com/share/53cae28a5d224e67b783c8ccf53745f5 Dev Response: This issue is valid but not a major inconvenience. We will try to track it and see if it needed to be addressed. Many other web tools do not handle such cases - [X] Canvas scrolls down when all widgets are selected. https://loom.com/share/c8a68dadcdb040779abd3a73bde2b06c - [X] Widget is not getting highlighted when added from the API editor page. Please refer to the attached video:-https://jiju8jbmwa.vmaker.com/record/IkwiAqFgafK9dVmu ## Checklist: ### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [x] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test --------- Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
148 lines
4.3 KiB
TypeScript
148 lines
4.3 KiB
TypeScript
import React, { useEffect } from "react";
|
|
import { Route, Switch } from "react-router-dom";
|
|
import { useLocation, useRouteMatch } from "react-router";
|
|
import ApiEditor from "./APIEditor";
|
|
import IntegrationEditor from "./IntegrationEditor";
|
|
import QueryEditor from "./QueryEditor";
|
|
import JSEditor from "./JSEditor";
|
|
import GeneratePage from "./GeneratePage";
|
|
import CurlImportForm from "./APIEditor/CurlImportForm";
|
|
import ProviderTemplates from "./APIEditor/ProviderTemplates";
|
|
import {
|
|
API_EDITOR_ID_PATH,
|
|
BUILDER_CHECKLIST_PATH,
|
|
BUILDER_CUSTOM_PATH,
|
|
CURL_IMPORT_PAGE_PATH,
|
|
GENERATE_TEMPLATE_FORM_PATH,
|
|
INTEGRATION_EDITOR_PATH,
|
|
JS_COLLECTION_EDITOR_PATH,
|
|
JS_COLLECTION_ID_PATH,
|
|
PROVIDER_TEMPLATE_PATH,
|
|
QUERIES_EDITOR_ID_PATH,
|
|
} from "constants/routes";
|
|
import styled from "styled-components";
|
|
import { useSelector } from "react-redux";
|
|
import PerformanceTracker, {
|
|
PerformanceTransactionName,
|
|
} from "utils/PerformanceTracker";
|
|
import * as Sentry from "@sentry/react";
|
|
import { SaaSEditorRoutes } from "./SaaSEditor/routes";
|
|
import OnboardingChecklist from "./FirstTimeUserOnboarding/Checklist";
|
|
import { DatasourceEditorRoutes } from "@appsmith/pages/routes";
|
|
import PropertyPaneContainer from "pages/Editor/WidgetsEditor/PropertyPaneContainer";
|
|
import { getPaneCount, isMultiPaneActive } from "selectors/multiPaneSelectors";
|
|
import { PaneLayoutOptions } from "reducers/uiReducers/multiPaneReducer";
|
|
|
|
const SentryRoute = Sentry.withSentryRouting(Route);
|
|
|
|
const Wrapper = styled.div<{ isVisible: boolean }>`
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: ${(props) => (!props.isVisible ? "0px" : "100%")};
|
|
height: 100%;
|
|
background-color: ${(props) => (props.isVisible ? "white" : "transparent")};
|
|
z-index: ${(props) => (props.isVisible ? 2 : -1)};
|
|
width: ${(props) => (!props.isVisible ? "0" : "100%")};
|
|
display: flex;
|
|
flex-direction: column;
|
|
`;
|
|
|
|
function EditorsRouter() {
|
|
const { path } = useRouteMatch();
|
|
const { pathname } = useLocation();
|
|
const isMultiPane = useSelector(isMultiPaneActive);
|
|
const paneCount = useSelector(getPaneCount);
|
|
|
|
useEffect(() => {
|
|
return () => {
|
|
PerformanceTracker.startTracking(
|
|
PerformanceTransactionName.CLOSE_SIDE_PANE,
|
|
{ path: pathname },
|
|
);
|
|
};
|
|
});
|
|
|
|
const showPropertyPane = isMultiPane
|
|
? paneCount === PaneLayoutOptions.TWO_PANE
|
|
: false;
|
|
|
|
return (
|
|
<Wrapper isVisible>
|
|
<Switch key={path}>
|
|
{showPropertyPane && (
|
|
<SentryRoute
|
|
component={PropertyPaneContainer}
|
|
exact
|
|
path={BUILDER_CUSTOM_PATH}
|
|
/>
|
|
)}
|
|
<SentryRoute
|
|
component={IntegrationEditor}
|
|
exact
|
|
path={`${path}${INTEGRATION_EDITOR_PATH}`}
|
|
/>
|
|
<SentryRoute
|
|
component={OnboardingChecklist}
|
|
exact
|
|
path={`${path}${BUILDER_CHECKLIST_PATH}`}
|
|
/>
|
|
<SentryRoute
|
|
component={ApiEditor}
|
|
exact
|
|
path={`${path}${API_EDITOR_ID_PATH}`}
|
|
/>
|
|
<SentryRoute
|
|
component={QueryEditor}
|
|
exact
|
|
path={`${path}${QUERIES_EDITOR_ID_PATH}`}
|
|
/>
|
|
<SentryRoute
|
|
component={JSEditor}
|
|
exact
|
|
path={`${path}${JS_COLLECTION_EDITOR_PATH}`}
|
|
/>
|
|
<SentryRoute
|
|
component={JSEditor}
|
|
exact
|
|
path={`${path}${JS_COLLECTION_ID_PATH}`}
|
|
/>
|
|
|
|
<SentryRoute
|
|
component={CurlImportForm}
|
|
exact
|
|
path={`${path}${CURL_IMPORT_PAGE_PATH}`}
|
|
/>
|
|
{SaaSEditorRoutes.map(({ component, path: childPath }) => (
|
|
<SentryRoute
|
|
component={component}
|
|
exact
|
|
key={path}
|
|
path={`${path}${childPath}`}
|
|
/>
|
|
))}
|
|
{DatasourceEditorRoutes.map(({ component, path: childPath }) => (
|
|
<SentryRoute
|
|
component={component}
|
|
exact
|
|
key={childPath}
|
|
path={`${path}${childPath}`}
|
|
/>
|
|
))}
|
|
<SentryRoute
|
|
component={ProviderTemplates}
|
|
exact
|
|
path={`${path}${PROVIDER_TEMPLATE_PATH}`}
|
|
/>
|
|
<SentryRoute
|
|
component={GeneratePage}
|
|
exact
|
|
path={`${path}${GENERATE_TEMPLATE_FORM_PATH}`}
|
|
/>
|
|
</Switch>
|
|
</Wrapper>
|
|
);
|
|
}
|
|
|
|
export default EditorsRouter;
|