1
1
import React , { useCallback , useEffect , useMemo } from "react" ;
2
2
import { IDEBottomView , ViewHideBehaviour } from "IDE" ;
3
+ import { PluginType } from "entities/Plugin" ;
4
+ import { getIsAnvilEnabledInCurrentApplication } from "layoutSystems/anvil/integrations/selectors" ;
3
5
import { ActionExecutionResizerHeight } from "./constants" ;
4
6
import EntityBottomTabs from "components/editorComponents/EntityBottomTabs" ;
5
7
import { useDispatch , useSelector } from "react-redux" ;
@@ -15,7 +17,8 @@ import { useDefaultTab } from "ee/PluginActionEditor/components/PluginActionResp
15
17
16
18
function PluginActionResponse ( ) {
17
19
const dispatch = useDispatch ( ) ;
18
- const { actionResponse } = usePluginActionContext ( ) ;
20
+ const { actionResponse, plugin } = usePluginActionContext ( ) ;
21
+ const isAnvilEnabled = useSelector ( getIsAnvilEnabledInCurrentApplication ) ;
19
22
20
23
const tabs = usePluginActionResponseTabs ( ) ;
21
24
@@ -36,6 +39,9 @@ function PluginActionResponse() {
36
39
// as for page load queries, query response is available and can be shown in response tab
37
40
useEffect (
38
41
function openResponseTabForPageLoadQueries ( ) {
42
+ // disable the opening of RESPONSE_TAB for the AI plugin in Anvil
43
+ if ( isAnvilEnabled && plugin . type === PluginType . AI ) return ;
44
+
39
45
// actionResponse and responseDisplayFormat is present only when query has response available
40
46
if (
41
47
! ! responseDisplayFormat ?. title &&
@@ -53,11 +59,16 @@ function PluginActionResponse() {
53
59
responseDisplayFormat ?. title ,
54
60
actionResponse ?. isExecutionSuccess ,
55
61
dispatch ,
62
+ isAnvilEnabled ,
63
+ plugin . type ,
56
64
] ,
57
65
) ;
58
66
59
67
useEffect (
60
68
function openResponseTabOnError ( ) {
69
+ // disable the opening of RESPONSE_TAB for the AI plugin in Anvil
70
+ if ( isAnvilEnabled && plugin . type === PluginType . AI ) return ;
71
+
61
72
if ( executionFailed ) {
62
73
dispatch (
63
74
setPluginActionEditorDebuggerState ( {
@@ -67,7 +78,7 @@ function PluginActionResponse() {
67
78
) ;
68
79
}
69
80
} ,
70
- [ executionFailed , dispatch ] ,
81
+ [ executionFailed , dispatch , isAnvilEnabled , plugin . type ] ,
71
82
) ;
72
83
73
84
useDefaultTab ( ) ;
0 commit comments