Skip to content

Document how to expand a parent node based on its children, remove expandParent from docs #760

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

Open
superstes opened this issue Feb 12, 2025 · 6 comments
Assignees
Labels
svelte-docs Issues belonging to the svelteflow website

Comments

@superstes
Copy link

What platform were you using when you found the bug?

  • React Flow / Svelte Flow version: 0.1.30
  • Browser and version: Chromium Version 133.0.6943.53 (Official Build)
  • OS and version: Debian GNU/Linux 12 (bookworm) (64-bit)

Live code example

https://stackblitz.com/edit/x75pr7nk-f4atnmyp

Describe the Bug

If expandParent: true is set for node 2a for the official docs-example - it does not work.
The same example for reactflow works as expected.

Steps to reproduce the bug or issue

  1. Add two nested nodes
  2. Add expandParent: true to the child-node
  3. Drag the child to an edge of the parent and see that the parents size does not change

Expected behavior

expandParent to work as seen in reactflow.

Screenshots or Videos

No response

Additional context

No response

@superstes
Copy link
Author

Same issue on 1.0.0-next.3 (#4878)

@peterkogo
Copy link
Member

We decided not to implement parentExpand in Svelte Flow because the feature is flawed in many ways and makes things just far too complicated.

Is this functionality what you are after? https://codesandbox.io/p/sandbox/boring-poitras-x5z223

I will make it an official example once I have ported it - should work pretty much the same way in Svelte Flow.

@superstes
Copy link
Author

superstes commented Feb 17, 2025

Thank you for the clarification.
In that case the docs should not mention that field: https://svelteflow.dev/api-reference/types/node#expand-parent

Is this functionality what you are after?

Yes - exactly. Will take a look 👍

@peterkogo
Copy link
Member

Good point! Will fix it!

@peterkogo peterkogo self-assigned this Feb 17, 2025
@superstes
Copy link
Author

If relevant: this is a very basic svelte-5 example for that functionality => https://stackblitz.com/edit/x75pr7nk-9bgtirai

Note: I'm not that experienced in using Svelte and xyflow. I'm sure it can be optimized.. (;

@superstes
Copy link
Author

superstes commented Feb 18, 2025

I've extended the example to include a resizable node.

What's interesting is that it works fine when resizing to the right or bottom. But to the top or left will result in something of a 'feedback loop' and the node and its parent 'fly off in the abyss' ^^
I would guess it has to do with the combination of position and size change of a child-node.
Might look into the expansion-handling the next days in more detail to understand what might be happening here..

@moklick moklick transferred this issue from xyflow/xyflow Apr 10, 2025
@moklick moklick changed the title svelteflow expandParent not working Document how to expand a parent node based on its children, remove expandParent from docs Apr 10, 2025
@moklick moklick added the svelte-docs Issues belonging to the svelteflow website label Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
svelte-docs Issues belonging to the svelteflow website
Projects
None yet
Development

No branches or pull requests

3 participants