Closed alexandru-dinu closed 2 years ago
Following suggestions from https://github.com/obsidianmd/obsidian-releases/pull/727#issuecomment-1019552433 -- the table state is now stored in a WeakMap<HTMLTableElement, TableState>
which is properly garbage collected.
If a reference to a table element is lost (e.g. when a file is closed), then the (key, value)
is removed.
This also has the advantage of not storing a unique id in DOM (to identify the table).
Currently,
tableState
is removed from the map when order becomes the default one.However, if the table is in an "ascending" or "descending" state, and the pane is closed, then the reference to it is lost. The
(key, value)
pair remains in the map.I see two possible solutions:
onPaneClosing
event (or similar) that removes all active references of the tables in the pane about to be closed.sortable-id=<uuid>
attribute, since it links the HTML entry to the plugin's internaltableStates
.