fix(extensions): say so when the staged host is too old to list vaults

A host that answers `vaults` with an error is a staged copy older than the
popup, which looked exactly like "you only have one vault" — the picker
silently fell back to its single default option. A missing host stays silent,
since pressing Fill already explains that one.

Also document that a second vault needs a ~/.obsidian-wiki/config.<name>
profile before it can appear in the list.
This commit is contained in:
ar9av
2026-08-15 15:33:02 -07:00
parent 27bcfea185
commit fcd91010a7
2 changed files with 20 additions and 4 deletions
+12
View File
@@ -98,6 +98,18 @@ one entry per `~/.obsidian-wiki/config.<name>`. It is the extension's equivalent
of the `@name` override: a job application answers from `personal`, a vendor
questionnaire from `work`, without re-pointing the symlink for everything else.
A second vault only shows up once it has a profile file. Owning the folder is
not enough — create one with `/wiki-switch new <name>`, or by hand:
```bash
printf '# My other vault\nOBSIDIAN_VAULT_PATH="%s"\n' ~/Knowledge \
> ~/.obsidian-wiki/config.knowledge
```
If the dropdown shows only `Default vault` when profiles do exist, the staged
host predates this feature — re-run `install.sh` and restart Chrome. The popup
says so explicitly rather than pretending you have one vault.
The choice is remembered per browser profile, so a vault picked once stays
picked. A profile whose `OBSIDIAN_VAULT_PATH` no longer exists is listed as
`(missing)` and cannot be selected — and if it was the remembered one, the popup
+8 -4
View File
@@ -252,16 +252,20 @@ vaultSelect.addEventListener("change", () => {
/**
* Ask the host which vaults exist and offer them as targets.
*
* Failure here is deliberately silent: the host may not be installed yet, and
* the picker is not what the user came for. The hardcoded "Default vault"
* option keeps Fill working exactly as it did before, and pressing Fill
* surfaces the real host error with its install instructions.
* A host that is missing entirely stays silent — it may simply not be
* installed, and pressing Fill surfaces that with its install instructions.
* A host that answers but rejects the request is different: it is a staged
* copy older than this popup, which otherwise looks identical to "you only
* have one vault" and hides the picker for no visible reason.
*/
async function loadVaults(preferred) {
let vaults;
try {
const response = await chrome.runtime.sendNativeMessage(HOST_NAME, { type: "vaults" });
vaults = response?.ok ? response.vaults : undefined;
if (!response?.ok) {
setStatus("Vault list unavailable — re-run host/install.sh, then ⌘Q and reopen Chrome.", "error");
}
} catch {
vaults = undefined;
}