mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] runtime: simplify info message when running in dev mode
The owl dev info message may be useful, but does not bring that much value. Also, this is even slightly annoying while debugging odoo, since it is common to have to go to dev mode, and the message takes some visual space, which is a distraction. In this commit, we simplify it to just warn that owl is in dev mode.
This commit is contained in:
+1
-10
@@ -29,15 +29,6 @@ export interface AppConfig<P, E> extends TemplateSetConfig, RootConfig<P, E> {
|
|||||||
|
|
||||||
let hasBeenLogged = false;
|
let hasBeenLogged = false;
|
||||||
|
|
||||||
export const DEV_MSG = () => {
|
|
||||||
const hash = (window as any).owl ? (window as any).owl.__info__.hash : "master";
|
|
||||||
|
|
||||||
return `Owl is running in 'dev' mode.
|
|
||||||
|
|
||||||
This is not suitable for production use.
|
|
||||||
See https://github.com/odoo/owl/blob/${hash}/doc/reference/app.md#configuration for more information.`;
|
|
||||||
};
|
|
||||||
|
|
||||||
const apps = new Set<App>();
|
const apps = new Set<App>();
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
@@ -88,7 +79,7 @@ export class App<
|
|||||||
}
|
}
|
||||||
this.warnIfNoStaticProps = config.warnIfNoStaticProps || false;
|
this.warnIfNoStaticProps = config.warnIfNoStaticProps || false;
|
||||||
if (this.dev && !config.test && !hasBeenLogged) {
|
if (this.dev && !config.test && !hasBeenLogged) {
|
||||||
console.info(DEV_MSG());
|
console.info(`Owl is running in 'dev' mode.`);
|
||||||
hasBeenLogged = true;
|
hasBeenLogged = true;
|
||||||
}
|
}
|
||||||
const env = config.env || {};
|
const env = config.env || {};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { makeTestFixture, nextAppError, nextTick, snapshotEverything } from "../helpers";
|
import { makeTestFixture, nextAppError, nextTick, snapshotEverything } from "../helpers";
|
||||||
import { Component, onError, xml, mount, OwlError, useState } from "../../src";
|
import { Component, onError, xml, mount, OwlError, useState } from "../../src";
|
||||||
import { App, DEV_MSG } from "../../src/runtime/app";
|
import { App } from "../../src/runtime/app";
|
||||||
import { validateProps } from "../../src/runtime/template_helpers";
|
import { validateProps } from "../../src/runtime/template_helpers";
|
||||||
import { Schema } from "../../src/runtime/validation";
|
import { Schema } from "../../src/runtime/validation";
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ let mockConsoleWarn: any;
|
|||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
console.info = (message: any) => {
|
console.info = (message: any) => {
|
||||||
if (message === DEV_MSG()) {
|
if (message === `Owl is running in 'dev' mode.`) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
info(message);
|
info(message);
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import {
|
|||||||
useState,
|
useState,
|
||||||
} from "../../src";
|
} from "../../src";
|
||||||
import { xml } from "../../src/";
|
import { xml } from "../../src/";
|
||||||
import { DEV_MSG } from "../../src/runtime/app";
|
|
||||||
import { elem, makeTestFixture, nextAppError, nextTick, snapshotEverything } from "../helpers";
|
import { elem, makeTestFixture, nextAppError, nextTick, snapshotEverything } from "../helpers";
|
||||||
|
|
||||||
let fixture: HTMLElement;
|
let fixture: HTMLElement;
|
||||||
@@ -30,7 +29,7 @@ snapshotEverything();
|
|||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
console.info = (message: any) => {
|
console.info = (message: any) => {
|
||||||
if (message === DEV_MSG()) {
|
if (message === `Owl is running in 'dev' mode.`) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
info(message);
|
info(message);
|
||||||
|
|||||||
Reference in New Issue
Block a user