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:
Robin Ward
2019-06-11 11:21:23 -04:00
committed by Joffrey JAFFEUX
parent 934adb14d2
commit c322cccd53
7 changed files with 81 additions and 47 deletions

View File

@@ -104,7 +104,7 @@ function initializePolls(api) {
}
api.includePostAttributes("polls", "polls_votes");
api.decorateCooked(attachPolls, { onlyStream: true });
api.decorateCooked(attachPolls, { onlyStream: true, id: "discourse-poll" });
api.cleanupStream(cleanUpPolls);
}