From 077c297ecb8a5b4edd458e5aa1ae686584d4c9d8 Mon Sep 17 00:00:00 2001 From: Muhsin Shah C P Date: Mon, 17 Jan 2022 09:07:34 +0530 Subject: [PATCH] Window title should change to app name when the user is on the editor page (#1824) * Fixed: tab title stays default * Added title change code to unmount function * Reversed the title --- frontend/src/Editor/Editor.jsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/frontend/src/Editor/Editor.jsx b/frontend/src/Editor/Editor.jsx index 3d610ab777..475e08f168 100644 --- a/frontend/src/Editor/Editor.jsx +++ b/frontend/src/Editor/Editor.jsx @@ -105,6 +105,10 @@ class Editor extends React.Component { }; } + setWindowTitle(name) { + document.title = name ? `${name} - Tooljet` : `Untitled App - Tooljet`; + } + componentDidMount() { this.fetchApps(0); this.fetchApp(); @@ -166,6 +170,7 @@ class Editor extends React.Component { if (this.state.socket) { this.state.socket?.close(); } + document.title = 'Tooljet - Dashboard'; } getWebsocketUrl = () => { @@ -324,6 +329,7 @@ class Editor extends React.Component { console.log('Default component state computed and set'); this.runQueries(data.data_queries); }); + this.setWindowTitle(data.name); } ); @@ -660,6 +666,7 @@ class Editor extends React.Component { this.setState({ app: { ...this.state.app, name: newName }, }); + this.setWindowTitle(newName); }; toggleQueryEditor = () => {