[BUG] Settings: getSettingsDefinition is only called once

per the docs

    /**
     * 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.

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

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

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 and used html in settings instead of markdown. was 32ms vs 3ms in creation time.