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
This commit is contained in:
Muhsin Shah C P 2022-01-17 09:07:34 +05:30 committed by GitHub
parent a02d47e88e
commit 077c297ecb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 = () => {