Skip to content

Plugin Fails to Save Manual Token Set Sort Order to ⁠$themes.json (Breaks Cascading Logic) #3772

@keeganedwin

Description

@keeganedwin

Describe the bug
The plugin fails to save the manual sort order of token sets defined in the UI into the ⁠$themes.json file. When a user manually reorders sets in the plugin (e.g., placing a specific brand set above a base set) and pushes changes to a remote provider (GitHub/GitLab), the plugin simply appends the new sets to the bottom of the list in the JSON file.

In a stacked theme system, Order = Priority (typically, sets lower in the list override those above, or vice-versa depending on specific configuration). If the JSON order does not match the intended UI order, the wrong tokens will "win" the override. For example, a "Base" token might accidentally override a "Brand" token because it was appended to the end of the JSON list, resulting in incorrect design values.

To Reproduce
Steps to reproduce the behavior:

  1. Connect the plugin to a remote provider (GitHub or GitLab).

  2. Create a new token set (e.g., ⁠new-theme).
  3. In the plugin UI, manually drag and drop this new set to a specific position in the list (not at the bottom).
  4. Push the changes to the remote provider.
  5. Inspect the ⁠$themes.json file in the commit diff.

  6. See error: The ⁠new-theme is appended to the very bottom of the list in the JSON, ignoring the manual position set in the UI.

Expected behavior
The order of token sets in ⁠$themes.json should exactly match the manual sort order defined by the user in the plugin UI. When pushing changes, the plugin should rewrite the list in the JSON to reflect the correct sequence, ensuring that cascading overrides function as intended.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    📥 Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions