-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Alert shows twice for select widget #26696
Comments
This no longer occurs |
Generated the possible solution through ChatGPT: Technical Solution (ChatGPT) Frontend (React) Ensure that the event listener for "onDropdownClosed" is correctly debounced or throttled to prevent multiple triggers.import React, { useState } from 'react';import Select from 'react-select'; // Assuming use of react-select library const CustomSelect = () => { const [isDropdownOpen, setDropdownOpen] = useState(false); const handleDropdownClose = () => { if (isDropdownOpen) { alert('Drop down closed'); setDropdownOpen(false); } }; return ( <Select options={[{ value: '1', label: 'Option 1' }, { value: '2', label: 'Option 2' }]} onMenuOpen={() => setDropdownOpen(true)} onMenuClose={handleDropdownClose} /> );}; export default CustomSelect; Backend (Spring Boot) Ensure the backend processes any event related to dropdown closing only once, if applicable. This might not be needed specifically for the dropdown closing event, but ensure idempotency in API calls if any backend actions are triggered by UI events. Solution Summary |
Hi @Nikhil-Nandagopal , I'm picking this issue. |
This issue occurs if we click on the widget again to close the dropdown . loom |
…elect widget (#34812) ## Description: > When using the select widget, setting the "onDropdownClosed" event to show an alert results in the alert being shown twice instead of once. > I have raised this PR to ensure that `show alert is called only once in the select widget on calling onCloseDropdown`. ## [Issue Link](#26696) ## Cypress video: https://github.com/appsmithorg/appsmith/assets/136346053/b602fd18-a7ed-4a0b-8546-cf29d90ba0f9 ## Screenshots: ### Before resolving bug: ![Screenshot from 2024-07-05 09-46-03](https://github.com/appsmithorg/appsmith/assets/136346053/451ca605-5c04-4473-8bc7-f1dfcf81890c) ### After resolving bug : ![Screenshot from 2024-07-08 08-55-14](https://github.com/appsmithorg/appsmith/assets/136346053/f2b113c4-9a07-479f-a6bf-607652e88ea2) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Tests** - Introduced new tests for the Select widget to validate `onDropdownClose`, `onDropdownOpen`, and `onOptionChange` events, ensuring alerts display correctly during interactions. - Added a test suite for the `SelectComponent` to verify that dropdown callbacks are triggered correctly. - **New Features** - Enhanced the visibility toggle logic for the Select widget's popover, improving user experience by preventing redundant actions when toggling via button clicks. - Added a specific method to handle button click events for toggling the popover visibility. - Improved responsiveness of the Select widget by ensuring active item updates only occur when the selected item changes. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Fixed via: #34812 |
Is there an existing issue for this?
Description
Attached screen shot :
![image](https://private-user-images.githubusercontent.com/134914630/263661243-2cbde085-de21-4422-95cf-3bd8d02e6f90.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNjQ1NzMsIm5iZiI6MTczOTE2NDI3MywicGF0aCI6Ii8xMzQ5MTQ2MzAvMjYzNjYxMjQzLTJjYmRlMDg1LWRlMjEtNDQyMi05NWNmLTNiZDhkMDJlNmY5MC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMFQwNTExMTNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1iMjVjMTQ5ZmYyNTdiYjdiMjJlNzgwNzY2YTlhYjY0YmQ3YmRmZDM4YWJkMjY4ZmIzNGU3YmFhMDkwODliODFjJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.kyncxOph1JqMtoCXZcLe99Xk-4HCCTMsFAkFqBd8uW8)
Steps To Reproduce
show alert
= Drop down closedPublic Sample App
No response
Environment
Production
Issue video log
No response
Version
Appsmith v1.9.35-SNAPSHOT
The text was updated successfully, but these errors were encountered: