---
number: 7667
title: 'fix/functional.component.Base: enhance destroy() signature'
author: ad1tyayadav
state: MERGED
createdAt: '2025-10-26T14:04:29Z'
updatedAt: '2025-10-27T10:45:01Z'
closedAt: '2025-10-27T10:45:01Z'
mergedAt: '2025-10-27T10:45:01Z'
head: fix-functional-destroy
base: dev
url: 'https://github.com/neomjs/neo/pull/7667'
---
Closes #7062

**What kind of change does this PR introduce?** (check at least one)
- [ ] Bugfix
- [x] Feature
- [ ] Code style update
- [x] Refactor
- [ ] Build-related changes
- [ ] Other, please describe:

**Does this PR introduce a breaking change?** (check one)
- [ ] Yes
- [x] No

**The PR fulfills this requirement:**
- [x] It's submitted to the `dev` branch, _not_ the `main` branch

**Other information:**

## Summary
Enhanced the `destroy()` method signature in `functional.component.Base` to match the pattern used in `component.Base` and `container.Base`.

## Changes
- Added `updateParentVdom` and `silent` parameters to the `destroy()` method
- Pass `silent=true` when destroying child components to prevent unnecessary vdom updates
- Pass parameters to `super.destroy()` for consistency with component hierarchy

## Why This Change?
- **Performance**: Prevents each child component from triggering individual vdom worker calls during batch destruction
- **Consistency**: Matches the established pattern in `component.Base` ([L1144](https://github.com/neomjs/neo/blob/dev/src/component/Base.mjs#L1144)) and `container.Base` ([L476](https://github.com/neomjs/neo/blob/dev/src/container/Base.mjs#L476))
- **Optimization**: Avoids unnecessary calls to the vdom worker when destroying components with multiple children

## Testing
The change follows the existing pattern from:
- `src/component/Base.mjs#L1144`
- `src/container/Base.mjs#L476`
- `src/component/Abstract.mjs#L284`

No breaking changes - the method remains backwards compatible with default parameter values.

## Comments

### `@ad1tyayadav` commented on 2025-10-26T14:16:21Z

Hey @tobiu can you please review this pr?

---

### `@tobiu` commented on 2025-10-27T10:44:18Z

**Input from Gemini:**

> ✦ This is an excellent and crucial optimization. My initial review was too superficial. After reviewing the 'Functional Components' epic and the base classes, I have a much deeper appreciation for this change.
> 
> When a `functional.component.Base` hosts classic components, it must act as a responsible owner for their lifecycle. This PR correctly applies the established, performant destruction pattern from `container.Base` to the functional component's classic children. By calling `destroy(false, true)`, it prevents a potential storm of VDOM updates and ensures that the two component paradigms can interoperate efficiently.
> 
> This is a great catch and a solid implementation. LGTM!

---

