Skip to content

Actions do not have access to parent nodes anymore #4166

@just-boris

Description

@just-boris

Describe the bug

I have an action that requires knowledge about parentNode of an element. A simplified version looks like this:

<script>
	function onMountAction(node) {
		console.log(!!node.parentElement);
	}	
</script>

<h1 use:onMountAction>Hello!</h1>

To Reproduce

Expected behavior
I expect that the action will be called after the node has been attached to the DOM. Because this is how it worked in the past versions.

Additional context
I am using this action to implement draggable element. It needs to know the parent node to properly compute positioning. Real code can be found here: https://github.com/just-boris/components-graph/blob/master/src/utils/drag.js#L2

I suspect that the issue was introduced by this PR: #4156

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions