Disable variable picker when no available variables (#9894)

- Disable variable picker when no available variables
(https://discord.com/channels/1130383047699738754/1331236819227906049)
<img width="496" alt="image"
src="https://github.com/user-attachments/assets/e4cb97c8-648c-4bdf-b230-49687113c9e6"
/>
This commit is contained in:
martmull
2025-01-28 18:53:26 +01:00
committed by GitHub
parent 7195614926
commit 5329dd0c63

View File

@ -47,6 +47,8 @@ export const WorkflowVariablesDropdown = ({
objectNameSingularToSelect,
});
const noAvailableVariables = availableVariablesInWorkflowStep.length === 0;
const initialStep =
availableVariablesInWorkflowStep.length === 1
? availableVariablesInWorkflowStep[0]
@ -72,11 +74,11 @@ export const WorkflowVariablesDropdown = ({
setSelectedStep(undefined);
};
if (disabled === true) {
if (disabled === true || noAvailableVariables) {
return (
<StyledDropdownVariableButtonContainer
isUnfolded={isDropdownOpen}
disabled={disabled}
disabled={true}
transparentBackground
>
<IconVariablePlus
@ -97,7 +99,6 @@ export const WorkflowVariablesDropdown = ({
clickableComponent={
<StyledDropdownVariableButtonContainer
isUnfolded={isDropdownOpen}
disabled={disabled}
transparentBackground
>
<IconVariablePlus size={theme.icon.size.sm} />