Ribbon Bug and Fix

### Steps to reproduce

1. Create an empty vault with one community plugin that adds its ribbon icon after an async step in `onload`. Many plugins do this (`await this.loadData()` → `addRibbonIcon`), e.g. Kanban and Templater. Minimal plugin:

```js

const { Plugin } = require(‘obsidian’);

module.exports = class LateRibbon extends Plugin {

async onload() {

await new Promise((r) => setTimeout(r, 500)); // stands in for `await this.loadData()`

this.addRibbonIcon(‘dice’, ‘Late ribbon icon’, () => {});

}

};

```

2. Hide that icon (right-click ribbon → uncheck), or set `.obsidian/workspace.json` → `“left-ribbon”: {“hiddenItems”: {“late-ribbon:Late ribbon icon”: true}}`.

3. Open the vault on a device that has **never opened it before**: a new machine, a reinstall, a fresh app-data folder, or a vault that arrived via Sync or git.

Full repro files: Obsidian 1.14.4: plugin ribbon icons' hidden state is reset and erased on a vault's first open on a device (repro + fix + workaround) · GitHub

### Did you follow the troubleshooting guide? [Y/N]

Y. Default theme, no snippets. Restricted mode can’t be used because the bug needs a community plugin, so the repro uses the single minimal plugin above.

### Expected result

The icon stays hidden, as saved in `workspace.json`.

### Actual result

- The icon is shown.

- The layout is saved before the plugin registers its icon, so its entry is **removed from `hiddenItems`**. The choice is lost permanently, not just for one session.

- 3/3 on first open; 0/3 on later opens of the same vault on the same device.

### Environment

```

SYSTEM INFO:

Obsidian version: 1.14.4

Installer version: 1.8.9

Operating system: Darwin Kernel Version 27.0.0: Tue Aug 11 21:02:57 PDT 2026; root:xnu-13432.1.9\~1/RELEASE_ARM64_T8132 27.0.0

Login status: not logged in

Language: en

Insider build toggle: off

Live preview: on

Base theme: adapt to system

Community theme: none

Snippets enabled: 0

Restricted mode: off

Plugins installed: 2

Plugins enabled: 1

    1: Late Ribbon (repro) v0.0.1

RECOMMENDATIONS:

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.

```

### Additional information

**Cause (from app.js, same code in 1.8.9 and 1.14.4):**

- `WorkspaceRibbon.load()` applies saved `hiddenItems` only to items already in `this.items`.

- `addRibbonItemButton()` creates unknown items with `hidden: false` and never checks the saved state.

- `serialize()` writes only the items that currently exist, so entries for icons that haven’t registered yet are dropped.

**Suggested fix:** keep the loaded map (`this.savedHidden = hiddenItems`). Use `hidden: this.savedHidden[id] ?? false` for new items in `addRibbonItemButton`. Merge in `serialize()` (`{…this.savedHidden, …current}`) so icons from plugins that haven’t loaded yet, or are disabled, keep their entry.

**Related:** the language-switch reports 84190, 71643 and 117524 have the same root cause. Ribbon IDs are `pluginId + “:” + localized title`, so after a language switch no saved key matches, and `serialize()` then erases the old keys. Fixing that case also needs a stable, non-localized ID.

**Workaround:** a small plugin that re-applies the saved value when an icon first registers (in the gist).