fix: prevent menu content to be rendered when there are no options (#38329)

## Description
Fixes an issue where JS run menu is being shown with no items in it.

Fixes #38151 

## Automation

/ok-to-test tags="@tag.IDE"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/12468478974>
> Commit: f032137f9b4d9eeda85dfe1bb8d26e2e19f64c3b
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12468478974&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.IDE`
> Spec:
> <hr>Mon, 23 Dec 2024 15:12:31 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Bug Fixes**
- Improved dropdown menu rendering logic to prevent displaying an empty
menu when no options are available.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Alex 2024-12-24 11:49:00 +03:00 committed by GitHub
parent 16953b8159
commit 52a394f362
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -69,6 +69,7 @@ export const JSFunctionRun = (props: Props) => {
{props.selected.label}
</Button>
</MenuTrigger>
{!!props.options.length && (
<MenuContent align="end" data-testid="t--js-functions-menu">
{props.options.map((option) => (
<JSFunctionItem
@ -78,6 +79,7 @@ export const JSFunctionRun = (props: Props) => {
/>
))}
</MenuContent>
)}
</Menu>
<Tooltip