Skip to content
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

support for the same node in mutiple places in the tree, please, like directed graph traversal.. #91

Open
YotamAviv opened this issue Apr 22, 2024 · 3 comments
Labels
question Further information is requested

Comments

@YotamAviv
Copy link

I'm using this tree in a project that allows navigating posts, their authors, comments, authors of the comments, other posts by those folks, etc..., and so it's possible and absoultely expected to be able to navigate to the same post or author through a variety of paths.
When this happens, I suffer the old and familiar, "Multiple widgets used the same GlobalKey." (I can use UniqueKey instances to avoid the errors, but the expansion state of the tiles are tied to the Nodes.)
I looked at the TreeController code, and it looks like it'd be possible to hold the expansion state of tiles not using the Node () but by using the TreeTile Widget instead, and this would support my use cleanly. But it might be more complicated.

I hope that submitting this request here is appropriate. I'm new to open source development in GitHub.
Please let me know if you'd be interested in supporting my use case. I'd be available to help.

Thanks!

@baumths
Copy link
Owner

baumths commented Apr 22, 2024

Hey @YotamAviv, could you provide a small reproducible example of your tree view code? I'm pretty sure this can be solved on the user end, without having to edit the package.

For example, you could use the following pattern for your keys: GlobalObjectKey('$pageName#${node.id}')

@baumths baumths added the question Further information is requested label Apr 22, 2024
@YotamAviv
Copy link
Author

YotamAviv commented Apr 23, 2024 via email

@baumths
Copy link
Owner

baumths commented Apr 23, 2024

Make sure your nodes have a unique id (usually the one that comes from the database). Then make sure your tree node class overrides the equality operator ==. You could also use give each TreeView its own TreeController.

Hope the moving goes as smoothly as it can go! I'm going through a big one at the moment too. 🙃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants