-
-
Notifications
You must be signed in to change notification settings - Fork 71
Description
Please fill out these Check-boxes
- I checked for existing similar issues
- I checked that the plugin is up to date
- The issue persists with all other plugins and themes disabled
Plugin Version
1.2.5
This Issue Occurs on
- Windows
- Linux
- macOS
- Android
- iOS
Debug Info
SYSTEM INFO:
Obsidian version: v1.7.7
Installer version: v1.4.13
Operating system: #202405300957~1728589823~24.04~3d61696~dev-Ubuntu SMP PREEMPT_DY 6.9.3-76060903-generic
Login status: not logged in
Language: en
Insider build toggle: off
Live preview: on
Base theme: adapt to system
Community theme: ITS Theme v1.2.88
Snippets enabled: 2
Restricted mode: off
Plugins installed: 8
Plugins enabled: 8
1: Meta Bind v1.2.5
2: JS Engine v0.1.20
3: CustomJS v1.0.21
4: Dataview v0.5.67
5: Iconize v2.14.6
6: Minimal Theme Settings v8.1.1
7: Style Settings v1.0.9
8: Templater v2.9.1
RECOMMENDATIONS:
Custom theme and snippets: for cosmetic issues, please first try updating your theme and disabling your snippets. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community theme and snippets.
Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.
Describe the Issue
I have 2 frontmatter properties, one called counters that contains a list of objects and the other defaultCounters.
defaultCounters:
key1:
slot1: false
slot2: false
key2:
slot1: false
slot2: false
counters:
key1:
slot1: true
slot2: false
key2:
slot1: false
slot2: trueI 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
label: ""
icon: moon-star
hidden: true
class: ""
tooltip: ""
id: long-rest-test
style: primary
actions:
- type: updateMetadata
bindTarget: counters.key1
evaluate: true
value: getMetadata('defaultCounters.key1')
- type: updateMetadata
bindTarget: counters.key2
evaluate: true
value: getMetadata('defaultCounters.key2')When running these actions the frontmatter gets updated as follows.
defaultCounters:
key1:
&a1
slot1: false
slot2: false
key2:
&a2
slot1: false
slot2: false
counters:
key1: *a1
key2: *a2It 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
- Copy the example markdown below and paste it into a note, ensuring to remove the
\escape character from the ```s that wrap the button definition
---
defaultCounters:
key1:
&a1
slot1: false
slot2: false
key2:
&a2
slot1: false
slot2: false
counters:
key1: *a1
key2: *a2
---
\`\`\`meta-bind-button
label: ""
icon: moon-star
hidden: true
class: ""
tooltip: ""
id: issue-test
style: primary
actions:
- type: updateMetadata
bindTarget: counters.key1
evaluate: true
value: getMetadata('defaultCounters.key1')
- type: updateMetadata
bindTarget: counters.key2
evaluate: true
value: getMetadata('defaultCounters.key2')
\`\`\`
`BUTTON[issue-test]`
`INPUT[toggle:counters.key1.slot1]`
`INPUT[toggle:counters.key1.slot2]`
`INPUT[toggle:counters.key2.slot1]`
`INPUT[toggle:counters.key2.slot2]`- Press the button and view the resulting frontmatter
Expected Behavior
When the button is pressed the updated metadata value for counters should look like the block below
counters:
key1:
slot1: false
slot2: false
key2:
slot1: false
slot2: falsewhen defaultCounters is
defaultCounters:
key1:
slot1: false
slot2: false
key2:
slot1: false
slot2: false