fix: fixes inability to rename other widgets, jsactions, pages (#9848)

* fixes inability to rename other widgets, jsactions, pages

* adds edge case to handle renaming non action based entities

* fix if check
This commit is contained in:
Ayangade Adeoluwa 2021-12-17 14:51:06 +01:00 committed by GitHub
parent 99d813971d
commit b763fa03d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -489,7 +489,7 @@ export const getExistingPageNames = createSelector(
export const getExistingWidgetNames = createSelector(
(state: AppState) => state.entities.canvasWidgets,
(widgets) => Object.values(widgets).map((widget) => widget.pageName),
(widgets) => Object.values(widgets).map((widget) => widget.widgetName),
);
export const getExistingActionNames = createSelector(
@ -507,7 +507,13 @@ export const getExistingActionNames = createSelector(
);
// if the current action being edited is on the same page, filter the actions on the page and return their names.
if (editingAction && editingAction[0].config.pageId === currentPageId) {
// or if the there is no current action being edited (this happens when a widget, or any other entity is being edited), return the actions on the page.
if (
(editingAction &&
editingAction.length > 0 &&
editingAction[0].config.pageId === currentPageId) ||
(editingAction && editingAction.length < 1)
) {
return actions.map(
(actionItem: { config: { name: string; pageId: string } }) => {
if (actionItem.config.pageId === currentPageId) {