mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 02:51:14 +08:00
FIX: Memory Leaks when decorating posts (#7749)
* Remove long-deprecated method * FIX: Memory Leaks when decorating posts Previously we'd keep creating mixins dynamically when decorating the same class. This code changes the API to recommend an `id` parameter for each decorator which will avoid leaks. All plugins should be updated to include this parameter, although if they don't in the meantime it'll just mean a warning in the console (and a continued leak.)
This commit is contained in:

committed by
Joffrey JAFFEUX

parent
934adb14d2
commit
c322cccd53
@ -2,9 +2,12 @@ import { withPluginApi } from "discourse/lib/plugin-api";
|
||||
import showModal from "discourse/lib/show-modal";
|
||||
|
||||
function initializeDiscourseLocalDates(api) {
|
||||
api.decorateCooked($elem => {
|
||||
$(".discourse-local-date", $elem).applyLocalDates();
|
||||
});
|
||||
api.decorateCooked(
|
||||
$elem => {
|
||||
$(".discourse-local-date", $elem).applyLocalDates();
|
||||
},
|
||||
{ id: "discourse-local-date" }
|
||||
);
|
||||
|
||||
api.onToolbarCreate(toolbar => {
|
||||
toolbar.addButton({
|
||||
|
Reference in New Issue
Block a user