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

Clone the root in Document::from_data_model_instance #110

Conversation

kennethloeffler
Copy link
Contributor

@kennethloeffler kennethloeffler commented Sep 19, 2023

Closes #109 (this is squarely my bug :D).

This PR alters Document::from_data_model_instance to clone the root directly instead of cloning each child, thereby preserving Ref properties that point across children. rbx-dom can probably better support this use case, but I'll need to investigate what the best solution is

I think this may also be a problem for Document::from_instance_array... we might be able to do something similar to this PR and create a dummy instance, clone_within the entire instance array as children, then do the transfer+destroy dance?

Sorry about the test file diff - I opted to use do blocks to prevent variable shadowing. I can just use different variable names if preferred

Copy link
Collaborator

@filiptibell filiptibell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for getting this fixed!

I think this may also be a problem for Document::from_instance_array

Hmm, I wonder if multi-root models with refs across those roots is supported by roblox (probably is?), and if it is, have we seen anyone use that? Either way we should probably support that too, yeah.

Tests look fine also. 👍

@kennethloeffler
Copy link
Contributor Author

Superseded by #117

@kennethloeffler kennethloeffler deleted the from-data-model-instance-clone-the-root branch October 4, 2023 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Serialized ObjectValue of a Place having Nil Values
2 participants