Conversation
vsasyan-ignf
commented
Feb 13, 2026
- refactor(Dropdown.vue): replace lodash debounce with setTimeout for hover updates
There was a problem hiding this comment.
Pull request overview
This PR refactors Dropdown.vue to remove the lodash debounce dependency and change how hover updates are deferred when hovering dropdown options.
Changes:
- Removed
lodashdebounceimport and thedebouncedHoverUpdatehelper. - Updated hover handling to use
setTimeout(..., 0)to deferscanStore.updateHoverScan(option).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| function handleOptionHover(option) { | ||
| if (props.nameDropdown !== 'Support' || props.nameDropdown !== 'Emulsion') { | ||
| debouncedHoverUpdate(option) | ||
| setTimeout(() => {scanStore.updateHoverScan(option)}, 0); | ||
| } |
There was a problem hiding this comment.
Replacing debounce(..., 0) with setTimeout(..., 0) changes behavior: multiple rapid hover events will now enqueue multiple updates instead of coalescing to the last one, which can spam the store and cause transient hover states. Consider implementing a simple debounce with a stored timeout id (clearTimeout + setTimeout) so only the latest hovered option updates, and clear any pending timeout when resetting/closing the dropdown to avoid stale hover updates after mouseleave.
| function handleOptionHover(option) { | ||
| if (props.nameDropdown !== 'Support' || props.nameDropdown !== 'Emulsion') { | ||
| debouncedHoverUpdate(option) | ||
| setTimeout(() => {scanStore.updateHoverScan(option)}, 0); |
There was a problem hiding this comment.
This line doesn’t match the repo’s Prettier config (semi: false) and typical formatting (extra semicolon and missing spaces inside the block). Please run Prettier / adjust formatting to avoid lint/format churn.
| setTimeout(() => {scanStore.updateHoverScan(option)}, 0); | |
| setTimeout(() => scanStore.updateHoverScan(option), 0) |
| * @param option | ||
| */ | ||
| function handleOptionHover(option) { | ||
| if (props.nameDropdown !== 'Support' || props.nameDropdown !== 'Emulsion') { |
There was a problem hiding this comment.
The condition props.nameDropdown !== 'Support' || props.nameDropdown !== 'Emulsion' is always true (a value can't be both 'Support' and 'Emulsion' at the same time), so hover updates will run even for those dropdowns. If the intent is to skip hover updates for both 'Support' and 'Emulsion', this should use an AND condition (or an explicit inclusion check) so the block is only entered when the dropdown name is neither value.
| if (props.nameDropdown !== 'Support' || props.nameDropdown !== 'Emulsion') { | |
| if (props.nameDropdown !== 'Support' && props.nameDropdown !== 'Emulsion') { |
* refactor(Dropdown.vue): replace lodash debounce with setTimeout for hover updates
d2bc28e to
ccbd8d4
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>