DEV: Unsilence this-property-fallback deprecation (#29855)
This one has the potential to be very noisy, so a special dedupliation handler is introduced. https://meta.discourse.org/t/337276
This commit is contained in:
parent
6e5d4ee492
commit
019ba099c8
|
@ -1,8 +1,4 @@
|
||||||
const DEPRECATION_WORKFLOW = [
|
const DEPRECATION_WORKFLOW = [
|
||||||
{
|
|
||||||
handler: "silence",
|
|
||||||
matchId: "ember-this-fallback.this-property-fallback",
|
|
||||||
},
|
|
||||||
{ handler: "silence", matchId: "discourse.select-kit" },
|
{ handler: "silence", matchId: "discourse.select-kit" },
|
||||||
{
|
{
|
||||||
handler: "silence",
|
handler: "silence",
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
import { registerDeprecationHandler } from "@ember/debug";
|
||||||
|
import { consolePrefix, getThemeInfo } from "discourse/lib/source-identifier";
|
||||||
|
|
||||||
|
let registered = false;
|
||||||
|
const seenMessages = new Set();
|
||||||
|
|
||||||
|
export default {
|
||||||
|
initialize() {
|
||||||
|
if (registered) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
registerDeprecationHandler((message, options, next) => {
|
||||||
|
if (options.id !== "ember-this-fallback.this-property-fallback") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// These errors don't have useful backtraces, but we can parse theme/plugin
|
||||||
|
// info from the message itself.
|
||||||
|
const pluginMatch = message.match(/\/plugins\/([\w-]+)\//)?.[1];
|
||||||
|
const themeIdMatch = message.match(/\/theme-(\d+)\//)?.[1];
|
||||||
|
|
||||||
|
if (pluginMatch || themeIdMatch) {
|
||||||
|
const source = {
|
||||||
|
type: pluginMatch ? "plugin" : "theme",
|
||||||
|
name: pluginMatch || getThemeInfo(parseInt(themeIdMatch, 10)),
|
||||||
|
id: themeIdMatch,
|
||||||
|
};
|
||||||
|
options.source = source;
|
||||||
|
message = `${consolePrefix(null, source)} ${message}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only print each message once, to avoid flood of console noise
|
||||||
|
if (seenMessages.has(message)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
seenMessages.add(message);
|
||||||
|
options.url = "https://meta.discourse.org/t/337276";
|
||||||
|
next(message, options);
|
||||||
|
});
|
||||||
|
|
||||||
|
registered = true;
|
||||||
|
},
|
||||||
|
};
|
|
@ -1,4 +1,4 @@
|
||||||
import DEBUG from "@glimmer/env";
|
import { DEBUG } from "@glimmer/env";
|
||||||
import { waitForPromise } from "@ember/test-waiters";
|
import { waitForPromise } from "@ember/test-waiters";
|
||||||
import mergeHTMLPlugin from "discourse/lib/highlight-syntax-merge-html-plugin";
|
import mergeHTMLPlugin from "discourse/lib/highlight-syntax-merge-html-plugin";
|
||||||
import { isTesting } from "discourse-common/config/environment";
|
import { isTesting } from "discourse-common/config/environment";
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { DEBUG } from "@glimmer/env";
|
||||||
import { registerDeprecationHandler } from "@ember/debug";
|
import { registerDeprecationHandler } from "@ember/debug";
|
||||||
import Service, { service } from "@ember/service";
|
import Service, { service } from "@ember/service";
|
||||||
import { addGlobalNotice } from "discourse/components/global-notice";
|
import { addGlobalNotice } from "discourse/components/global-notice";
|
||||||
|
@ -19,9 +20,13 @@ export const CRITICAL_DEPRECATIONS = [
|
||||||
"discourse.plugin-outlet-tag-name",
|
"discourse.plugin-outlet-tag-name",
|
||||||
"discourse.plugin-outlet-parent-view",
|
"discourse.plugin-outlet-parent-view",
|
||||||
"discourse.d-button-action-string",
|
"discourse.d-button-action-string",
|
||||||
/^(?!discourse\.)/, // All unsilenced ember deprecations
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (DEBUG) {
|
||||||
|
// used in system specs
|
||||||
|
CRITICAL_DEPRECATIONS.push("fake-deprecation");
|
||||||
|
}
|
||||||
|
|
||||||
// Deprecation handling APIs don't have any way to unregister handlers, so we set up permanent
|
// Deprecation handling APIs don't have any way to unregister handlers, so we set up permanent
|
||||||
// handlers and link them up to the application lifecycle using module-local state.
|
// handlers and link them up to the application lifecycle using module-local state.
|
||||||
let handler;
|
let handler;
|
||||||
|
|
Loading…
Reference in New Issue