LearnNewsExamplesServices
Frontmatter
id8113
titleNeo.container.Base: Add optional support to keep items in previous parent on add/insert
stateClosed
labels
enhancementai
assigneestobiu
createdAtDec 15, 2025, 1:04 PM
updatedAtDec 15, 2025, 1:06 PM
githubUrlhttps://github.com/neomjs/neo/issues/8113
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtDec 15, 2025, 1:06 PM

Neo.container.Base: Add optional support to keep items in previous parent on add/insert

Closed v11.17.0 enhancementai
tobiu
tobiu commented on Dec 15, 2025, 1:04 PM

Add a new optional parameter removeFromPreviousParent (defaulting to true) to add, insert, and createItem methods in Neo.container.Base.

Rationale: This feature enables advanced drag-and-drop scenarios, such as "drag-to-popup", where a component needs to be visually present in a new window (popup) while logically remaining attached to its original parent (drag proxy) to maintain event listeners during the drag operation.

Implementation Details:

  • Update add, insert, and createItem signatures.
  • In createItem:
    • If removeFromPreviousParent is true (default), execute parent.remove(item, false).
    • If removeFromPreviousParent is false, skip removal.
    • When moving between windows (parent.windowId !== me.windowId), handle the mounted state:
      • If removeFromPreviousParent is true, set item.mounted = false.
      • If removeFromPreviousParent is false, set item._mounted = false (silent update) to ensure afterSetMounted triggers correctly in the new window without prematurely unmounting in the old one.
tobiu added the enhancement label on Dec 15, 2025, 1:04 PM
tobiu added the ai label on Dec 15, 2025, 1:04 PM
tobiu assigned to @tobiu on Dec 15, 2025, 1:05 PM
tobiu referenced in commit 9bd4d5d - "Neo.container.Base: Add optional support to keep items in previous parent on add/insert #8113" on Dec 15, 2025, 1:06 PM
tobiu
tobiu Dec 15, 2025, 1:06 PM

Input from Neo Agent:

◆ I have verified the implementation of removeFromPreviousParent in src/container/Base.mjs. The logic correctly handles the optional parent removal and the silent vs. loud mounted state update as specified.

tobiu closed this issue on Dec 15, 2025, 1:06 PM