Skip to content

Button with updateMetadata action does not allow [... new Set(x.concat(["element"]))] syntax. #439

@dbarenholz

Description

@dbarenholz

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.2

This Issue Occurs on

  • Windows
  • Linux
  • macOS
  • Android
  • iOS

Debug Info

SYSTEM INFO:
	Obsidian version: v1.7.4
	Installer version: v1.6.7
	Operating system: #1 SMP PREEMPT_DYNAMIC Sat Aug  3 09:55:34 UTC 2024 6.9.12-203.fsync.fc40.x86_64
	Login status: logged in
	Language: en
	Catalyst license: supporter
	Insider build toggle: on
	Live preview: off
	Base theme: dark
	Community theme: halcyon v0.0.3
	Snippets enabled: 8
	Restricted mode: off
	Plugins installed: 13
	Plugins enabled: 13
		1: Discord Rich Presence v1.5.1
		2: Dynamic Table of Contents (manual install - deprecated) v0.0.27
		3: Latex Suite v1.9.5
		4: Sortable v0.3.1
		5: Style Settings v1.0.9
		6: Tag Wrangler v0.6.1
		7: Templater v2.8.1
		8: Meta Bind v1.2.2
		9: Linter v1.26.0
		10: JS Engine v0.1.17
		11: TikZJax v0.5.2
		12: Base Tag Renderer v1.2.1
		13: Periodic Notes v0.0.17

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

When you have a list in YAML, and you create a button that should append to the list only once by using spreading notation [... new Set(x.concat(["element"]))], Meta Bind complains with a "YAML Parse Error", whereas this is valid JavaScript, and runs in the console.

Steps to Reproduce

  1. Make a note with a list in properties, for instance my_list: [].
  2. Create a button with the updateMetadata action, bound to that property. Set evaluate to true.
  3. Set the value to precisely [... new Set(x.concat(["element"]))]
  4. Notice how MB throws the YAML Parse Error

Expected Behavior

If MB mentions that the value is interpreted as JavaScript, I expect this to work as it does in the console (e.g. the value "element" is added to the property once and only once). If there's a good reason why it shouldn't work, please update the docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUndesired behavior caused by this plugin

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions