-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Cannot copy complex objects from metadata #490
Comments
I would like to add that I am happy to help contribute a fix for this but I have no experience building Obsidian plugins and would need some help getting started. |
I am able to reproduce the issue. This can be fixed from the side of the plugin, but it seems like something that Obsidian should fix from their side. I might open a bug report on the Obsidian forum. In the meantime you can try |
Thanks for the quick response! I'll give that a try soon when I have my tablet with me and keep you posted on the result. If you submit the bug on the forum I'd love the link to keep an eye on it. If not let me know and I can report it there instead. |
So I got a chance to try it and it worked for the example I gave you. That was a simplified version of my actual metadata, wherein my real case has an extra level of nesting under one of the keys. e.g. counters:
key1:
nestedKey1:
slot1: true
slot2: false In this example the Despite it not behaving as expected, it ended up working out as the values are all false and the keys get recreated when toggling the checkbox to checked. |
Thanks for sharing the link! Gonna join the forums there so I can also track the upstream issue. Clicked through the link to the YAML spec and I'd never been aware that YAML has alias nodes. I use YAML frequently outside of frontmatter but it never dawned on me that it was a language feature. The write up you've done there is fantastic and incredibly thorough. Thank you again for taking the time to address this in such detail! |
Please fill out these Check-boxes
Plugin Version
1.2.5
This Issue Occurs on
Debug Info
Describe the Issue
I have 2 frontmatter properties, one called
counters
that contains a list of objects and the otherdefaultCounters
.I am using toggles to display these and created a button template to reset them alongside other values that are tracked. I am including only the relevant actions of this button in the example but there are a few more.
Note
This button is a template created with the builder in the plugin settings
When running these actions the frontmatter gets updated as follows.
It looks to me as though it can only ever set the value as a reference to the
defaultCounters.key(1|2)
values.I have tried other variations for the
value
in the templates such as:JSON.parse(JSON.stringify(getMetadata(defaultCounters.key1)))
{...getMetadata(defaultCounters.key1)}
Object.assign({}, getMetadata(defaultCounters.key1))
Steps to Reproduce
\
escape character from the ```s that wrap the button definitionExpected Behavior
When the button is pressed the updated metadata value for
counters
should look like the block belowwhen
defaultCounters
isThe text was updated successfully, but these errors were encountered: