fixes: action: showModal and closeModal throws error on trigger (#5315)

Co-authored-by: arpitnath <arpitnath42@gmail.com>
This commit is contained in:
Sherfin Shamsudeen 2023-01-12 17:02:45 +05:30 committed by GitHub
parent 73cd573b0e
commit ef787cf484
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -448,6 +448,10 @@ export const hightlightMentionedUserInComment = (comment) => {
};
export const generateAppActions = (_ref, queryId, mode, editorState, isPreview = false) => {
const currentPageId = _ref.state.currentPageId;
const currentComponents = _ref.state?.appDefinition?.pages[currentPageId]?.components
? Object.entries(_ref.state.appDefinition.pages[currentPageId]?.components)
: {};
const runQuery = (queryName = '') => {
const query = isPreview
? _ref.state.dataQueries.find((query) => query.name === queryName)
@ -510,7 +514,7 @@ export const generateAppActions = (_ref, queryId, mode, editorState, isPreview =
const showModal = (modalName = '') => {
let modal = '';
for (const [key, value] of Object.entries(_ref.state.appDefinition.components)) {
for (const [key, value] of currentComponents) {
if (value.component.name === modalName) {
modal = key;
}
@ -525,7 +529,7 @@ export const generateAppActions = (_ref, queryId, mode, editorState, isPreview =
const closeModal = (modalName = '') => {
let modal = '';
for (const [key, value] of Object.entries(_ref.state.appDefinition.components)) {
for (const [key, value] of currentComponents) {
if (value.component.name === modalName) {
modal = key;
}