Adopt Obsidian 1.13's declarative settings API for the plugin settings tab #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
The settings tab is imperative:
display()empties the container and rebuilds everything, from fetches that are a snapshot of the instant the pane opened. That is why a freshly signed-in vault listed itself as "not connected" until the pane was closed and reopened (fixed by an event fan-out plus a slow poll, with sections that own and rebuild their own containers).Obsidian 1.13.0 deprecates
display()and adds a declarative API that is the platform's own answer to a pane that stays current.What the API offers (from
obsidian.d.ts1.13.1)getSettingDefinitions()returns definitions;update()is "called by addSettingTab() and by dynamic tabs when their data changes";refreshDomState()re-evaluatesvisible/disabledpredicates in place with no re-render.renderrows: an imperative escape hatchrender(setting, group)that may return a cleanup function, invoked before the row is torn down.groupandlistdefinitions with heading, empty state, drag-to-reorder and an add affordance — the markup we currently emit by hand viarowGroup().What makes it a rewrite rather than a fix
display()is never called.getControlValue/setControlValue, so the "type, then Save" rows (display name, share link) change shape.renderrows; whether a render row can escape the row layout to draw a centred card is not answered by the typings..setting-item,h4headings, row-group markup) and would need re-pinning against declarative output.@since 1.13.0); expect churn.Spike first — three unknowns
update()preserve scroll position, focus and an open<details>?renderrow carry the sign-in card (centred column, brand header)?update()behave under the existing end-to-end DOM polls?Groundwork already in place
The current pane fix was built to feed this migration, not fight it:
onChange(reason)fan-out is what a declarative tab would subscribe to in order to callupdate();Not blocking
Our manifest already requires 1.13.7, so no version gate is needed.
Spike done on 14 September 2026 under #5: the three unknowns are answered there (update() rebuilds and keeps scroll/control focus but not an open details; a render row can carry the sign-in card once its host row is neutralised; the page lifecycle is clean). Migration proceeds as Phase C of the sessions/devices plan; this issue is superseded by #5.
Superseded: the declarative-API question was answered by the spike on #5 and the pane now renders from definitions (
9806346).