# \[BUG\] Settings: getSettingsDefinition is only called once

**URL:** <https://forum.obsidian.md/t/bug-settings-getsettingsdefinition-is-only-called-once/117735>\
**Category:** Devs: Plugins & API\
**Tags:** settings\
**Created:** [August 26, 2026, 7:51pm UTC](https://forum.obsidian.md/t/bug-settings-getsettingsdefinition-is-only-called-once/117735 "2026-08-26T19:51:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![superle3](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/s/ea666f/32.png) [@superle3](https://forum.obsidian.md/u/superle3)\
**Post date:** [August 26, 2026, 7:51pm UTC](https://forum.obsidian.md/t/bug-settings-getsettingsdefinition-is-only-called-once/117735/1 "2026-08-26T19:51:44Z")

</div>

per the docs

```auto
    /**
     * Override to provide setting definitions. Return an array of definitions
     * and inline groups. Called on every display() and once when the tab is
     * added to the setting modal for search indexing.
     * @public
     * @since 1.13.0
     */

```

`getSettingsDefinition` should be called every time `display` would have been called and once more for the indexing, but currently it’s only called for the indexing and not when `display` would have been called

easy to test with either `console.log(1)` or set the name to `Math.random().toString()` and switch from general to your settings and back with either `display` defined or `getSettingsDefinition` defined.

but `hide` is called everytime its hidden/switched so unsure how to do cleanup/ if any cleanup should be done.

---

<div class="post-metadata">

**Author:** ![Hesprs](https://forum.obsidian.md/user_avatar/forum.obsidian.md/hesprs/32/88786_2.png) [@Hesprs](https://forum.obsidian.md/u/Hesprs)\
**Post date:** [August 27, 2026, 1:17am UTC](https://forum.obsidian.md/t/bug-settings-getsettingsdefinition-is-only-called-once/117735/2 "2026-08-27T01:17:13Z")

</div>

Not sure whether the JSDoc is right. But in practice, it is only called once on registration. Calling `SettingTab.update()` calls it again.

---

<div class="post-metadata">

**Author:** ![superle3](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/s/ea666f/32.png) [@superle3](https://forum.obsidian.md/u/superle3)\
**Post date:** [August 27, 2026, 1:59pm UTC](https://forum.obsidian.md/t/bug-settings-getsettingsdefinition-is-only-called-once/117735/3 "2026-08-27T13:59:12Z")

</div>

> Not sure whether the JSDoc is right.

Its the official docs, it should be right

not calling `update`, but even if i was i guess i am going to do the cleanup inside `getSettingsDefinition` before i am creating my definitions.

So in my specific case for `MarkdownRenderer.render`

Do

```auto
component.unload()
// Create defs
component.load()
return defs

```

(Though I didn’t see memory leaking so not sure when it’s actually needed)

edit:  
used [sanitizeHTMLToDom - Developer Documentation](https://docs.obsidian.md/Reference/TypeScript+API/sanitizeHTMLToDom) and used html in settings instead of markdown. was 32ms vs 3ms in creation time.
