DEV: Update `backburner.js` to include bugfix and dev improvements (#18549)

This version of backburner is patched to include
- Fix for scheduleOnce/cancel bug: https://github.com/BackburnerJS/backburner.js/pull/402
- Async stack debugging in Chrome: https://github.com/BackburnerJS/backburner.js/pull/404

The async debugging feature is enabled only in debug builds of Discourse to ensure production performance is unaffected.

Adding to `vendorFiles` causes the JS to be inserted directly after the `ember-source` bundle. That means that the `backburner` module defined by ember-source will be replaced with the patched version.
This commit is contained in:
David Taylor 2022-10-12 10:06:03 +01:00 committed by GitHub
parent 1631394826
commit ad37c6c017
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 0 deletions

View File

@ -12,12 +12,18 @@ import Session from "discourse/models/session";
import { setDefaultOwner } from "discourse-common/lib/get-owner";
import { setIconList } from "discourse-common/lib/icon-library";
import { setURLContainer } from "discourse/lib/url";
import runloop from "@ember/runloop";
import { DEBUG } from "@glimmer/env";
export default {
name: "discourse-bootstrap",
// The very first initializer to run
initialize(container) {
if (DEBUG) {
runloop._backburner.ASYNC_STACKS = true;
}
setURLContainer(container);
setDefaultOwner(container);

View File

@ -79,6 +79,12 @@ module.exports = function (defaults) {
// We need to build tests in prod for theme tests
tests: true,
vendorFiles: {
// Freedom patch - includes bug fix and async stack support
// https://github.com/discourse/backburner.js/commits/discourse-patches
backburner: "node_modules/backburner.js/dist/named-amd/backburner.js",
},
});
// Patching a private method is not great, but there's no other way for us to tell

View File

@ -37,6 +37,7 @@
"admin": "^1.0.0",
"discourse-plugins": "^1.0.0",
"babel-plugin-ember-template-compilation": "^1.0.2",
"backburner.js": "https://github.com/discourse/backburner.js#discourse-patches",
"bootstrap": "3.4.1",
"broccoli-asset-rev": "^3.0.0",
"deepmerge": "^4.2.2",

View File

@ -2581,6 +2581,10 @@ backbone@^1.1.2:
dependencies:
underscore ">=1.8.3"
"backburner.js@https://github.com/discourse/backburner.js#discourse-patches":
version "2.7.0"
resolved "https://github.com/discourse/backburner.js#4b227c302c8a2bfa604dcdcca3802ed018423683"
backo2@1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/backo2/-/backo2-1.0.2.tgz#31ab1ac8b129363463e35b3ebb69f4dfcfba7947"