From ed35e0d8e415e9bb620fca2dd58a40ec71ad1dba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Thu, 31 Jan 2019 14:48:06 +0100 Subject: [PATCH] small cleanup --- README.md | 1 + web/static/src/ts/main.ts | 2 +- web/static/src/ts/services/action_manager.ts | 5 +++-- web/static/src/ts/widgets/Action.ts | 6 ++++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1a8a6797..59c96e94 100644 --- a/README.md +++ b/README.md @@ -166,6 +166,7 @@ We have 3 main folders and 3 main files: list c. t-keep-alive: makes sure the widget is not destroyed when removed from the DOM (note that it will still be destroyed when parent is destroyed) +3. t-ref ## Random Notes diff --git a/web/static/src/ts/main.ts b/web/static/src/ts/main.ts index ddfe2c47..55d605c8 100644 --- a/web/static/src/ts/main.ts +++ b/web/static/src/ts/main.ts @@ -29,5 +29,5 @@ document.addEventListener("DOMContentLoaded", async function() { env.isMobile = isMobile; rootWidget.render(); } - }, 100)); + }, 50)); }); diff --git a/web/static/src/ts/services/action_manager.ts b/web/static/src/ts/services/action_manager.ts index 26ca679a..7412e7b9 100644 --- a/web/static/src/ts/services/action_manager.ts +++ b/web/static/src/ts/services/action_manager.ts @@ -68,8 +68,8 @@ export class ActionManager extends EventBus implements IActionManager { doAction(request: ActionRequest) { if (typeof request === "number") { // this is an action ID - let name = request === 1 ? 'discuss' : 'crm'; - let title = request === 1 ? 'Discuss': 'CRM'; + let name = request === 1 ? "discuss" : "crm"; + let title = request === 1 ? "Discuss" : "CRM"; let Widget = this.registry.getAction(name); this.stack = [ { @@ -96,3 +96,4 @@ export class ActionManager extends EventBus implements IActionManager { this.doAction(actionID); } } +} diff --git a/web/static/src/ts/widgets/Action.ts b/web/static/src/ts/widgets/Action.ts index a278ede5..f442e978 100644 --- a/web/static/src/ts/widgets/Action.ts +++ b/web/static/src/ts/widgets/Action.ts @@ -16,8 +16,10 @@ export class Action extends Widget { } shouldUpdate(nextProps: Props) { - this.props = nextProps; - this.setContentWidget(); + if (nextProps.stack !== this.props.stack) { + this.props = nextProps; + this.setContentWidget(); + } return false; }