PromucFlow_constructor/app/client/src/utils/history.ts
Hetu Nandu c2dbebf9b7
fix: Do not set widget ancestry if selection happens via canvas (#22069)
## Description

Implemented in #21317. A problem arose where if a widget that exists
inside a tabs widget is setting the default value of the tab in order to
navigate change the tab, it would fail to switch it because the selected
widget logic takes over.

> Improve selected widget visibility by skipping feature when selection
happens via a canvas click

Fixes #22070


Media



https://user-images.githubusercontent.com/12022471/229714138-55f89cda-3c27-4953-91c0-46f5a9834adf.mov




## Type of change

> Please delete options that are not relevant.

- Bug fix (non-breaking change which fixes an issue)


## How Has This Been Tested?

- Manual
- Cypress

### Test Plan
> Add Testsmith test cases links that relate to this PR

### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)


## 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
- [ ] 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
2023-04-10 12:55:14 +05:30

21 lines
722 B
TypeScript

// Leaving this require here. Importing causes type mismatches which have not been resolved by including the typings or any other means. Ref: https://github.com/remix-run/history/issues/802
const createHistory = require("history").createBrowserHistory;
import type { History } from "history";
const history: History<AppsmithLocationState> = createHistory();
export default history;
export enum NavigationMethod {
CommandClick = "CommandClick",
EntityExplorer = "EntityExplorer",
Omnibar = "Omnibar",
Debugger = "Debugger",
CanvasClick = "CanvasClick",
ActionBackButton = "ActionBackButton",
ContextSwitching = "ContextSwitching",
}
export type AppsmithLocationState = {
invokedBy?: NavigationMethod;
};