Skip to content

fix(ui): feature-detect Obsidian 1.13 settings/button APIs - #53

Merged
istefox merged 1 commit into
mainfrom
fix/obsidian-review-compat
Jul 23, 2026
Merged

fix(ui): feature-detect Obsidian 1.13 settings/button APIs#53
istefox merged 1 commit into
mainfrom
fix/obsidian-review-compat

Conversation

@istefox

@istefox istefox commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • setDestructive() and getSettingDefinitions() are Obsidian 1.13.0+, but minAppVersion stays 1.7.2.
  • New src/ui/button-compat.ts feature-detects setDestructive() at runtime, falling back to the deprecated but always-present setWarning() on older hosts (confirm-modal.ts, chain-wizard-modal.ts).
  • settings-tab.ts now implements getSettingDefinitions() (makes every setting searchable on 1.13+) while keeping display() as the documented fallback for older hosts, where getSettingDefinitions is never called. Each field's control logic lives in one shared private method used by both paths, so they can't drift apart.

Test plan

  • npm run build (typecheck + production build)
  • npm run lint
  • npx vitest run (362 tests passing, no domain logic changed)
  • Manual Obsidian-vault smoke test of the Settings tab (declarative rendering can't be verified outside a live Obsidian instance)

setDestructive() and getSettingDefinitions() are Obsidian 1.13.0+, but
minAppVersion stays 1.7.2. Buttons fall back to setWarning() when
setDestructive is absent; the settings tab keeps display() as the
documented fallback, with getSettingDefinitions() driving the declarative
renderer (and Settings search) on newer hosts.
@istefox
istefox merged commit 64e4fdc into main Jul 23, 2026
2 checks passed
@istefox
istefox deleted the fix/obsidian-review-compat branch July 23, 2026 15:43
@istefox istefox mentioned this pull request Jul 23, 2026
3 tasks
istefox added a commit that referenced this pull request Jul 23, 2026
Bump manifest.json, package.json, package-lock.json, versions.json to
1.5.0. Adds Obsidian 1.13 settings-search support and setDestructive
feature-detection (PR #53) since v1.4.2. minAppVersion stays 1.7.2.
istefox added a commit that referenced this pull request Jul 23, 2026
…#55)

setDestructive(), getSettingDefinitions(), and SettingGroup.addSetting()
are all newer than minAppVersion 1.7.2. Runtime feature-detection doesn't
satisfy obsidianmd/no-unsupported-api: the review bot flags every static
reference regardless of the guard. Reverts settings-tab.ts, confirm-modal.ts,
and chain-wizard-modal.ts to their pre-PR-#53 state and removes
button-compat.ts.
istefox added a commit that referenced this pull request Jul 23, 2026
…57)

The previous attempt (PR #53, reverted in #55) gated setDestructive()/
getSettingDefinitions()/SettingGroup.addSetting() behind typeof checks,
which obsidianmd/no-unsupported-api does not recognize as a guard.
Verified by reading the rule's source and reproducing both the failure
and the fix in an isolated eslint-plugin-obsidianmd install: only
requireApiVersion("1.13.0") is recognized. minAppVersion stays 1.7.2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant