From cf8039f643490a273f72b61e47270def41525f6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Thu, 16 Jan 2025 10:23:26 +0100 Subject: [PATCH] [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. --- src/runtime/app.ts | 11 +---------- tests/components/props_validation.test.ts | 4 ++-- tests/misc/portal.test.ts | 3 +-- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/runtime/app.ts b/src/runtime/app.ts index 9431e6e7..7c13ae31 100644 --- a/src/runtime/app.ts +++ b/src/runtime/app.ts @@ -29,15 +29,6 @@ export interface AppConfig extends TemplateSetConfig, RootConfig { 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(); declare global { @@ -88,7 +79,7 @@ export class App< } this.warnIfNoStaticProps = config.warnIfNoStaticProps || false; if (this.dev && !config.test && !hasBeenLogged) { - console.info(DEV_MSG()); + console.info(`Owl is running in 'dev' mode.`); hasBeenLogged = true; } const env = config.env || {}; diff --git a/tests/components/props_validation.test.ts b/tests/components/props_validation.test.ts index b1b8e81b..40c4ad24 100644 --- a/tests/components/props_validation.test.ts +++ b/tests/components/props_validation.test.ts @@ -1,6 +1,6 @@ import { makeTestFixture, nextAppError, nextTick, snapshotEverything } from "../helpers"; 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 { Schema } from "../../src/runtime/validation"; @@ -13,7 +13,7 @@ let mockConsoleWarn: any; beforeAll(() => { console.info = (message: any) => { - if (message === DEV_MSG()) { + if (message === `Owl is running in 'dev' mode.`) { return; } info(message); diff --git a/tests/misc/portal.test.ts b/tests/misc/portal.test.ts index e07d524f..39c622a4 100644 --- a/tests/misc/portal.test.ts +++ b/tests/misc/portal.test.ts @@ -11,7 +11,6 @@ import { useState, } from "../../src"; import { xml } from "../../src/"; -import { DEV_MSG } from "../../src/runtime/app"; import { elem, makeTestFixture, nextAppError, nextTick, snapshotEverything } from "../helpers"; let fixture: HTMLElement; @@ -30,7 +29,7 @@ snapshotEverything(); beforeAll(() => { console.info = (message: any) => { - if (message === DEV_MSG()) { + if (message === `Owl is running in 'dev' mode.`) { return; } info(message);