mirror of
https://github.com/mue/mue.git
synced 2026-07-21 16:04:22 +02:00
fix: update french translation, fix language bug and use abort controller on more tabs
Co-authored-by: Alex Sparkes <turbomarshmello@gmail.com>
This commit is contained in:
@@ -41,6 +41,10 @@ export default class About extends React.PureComponent {
|
||||
});
|
||||
}
|
||||
|
||||
if (this.controller.signal.aborted === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
const newVersion = versionData[0].tag_name;
|
||||
|
||||
let updateMsg = this.language.version.no_update;
|
||||
@@ -48,9 +52,6 @@ export default class About extends React.PureComponent {
|
||||
updateMsg = `${this.language.version.update_available}: ${newVersion}`;
|
||||
}
|
||||
|
||||
if (this.controller.signal.aborted === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
contributors: contributors.filter((contributor) => !contributor.login.includes('bot')),
|
||||
|
||||
@@ -9,10 +9,15 @@ export default class Changelog extends React.PureComponent {
|
||||
title: null
|
||||
};
|
||||
this.language = window.language.modals.update;
|
||||
this.controller = new AbortController();
|
||||
}
|
||||
|
||||
async getUpdate() {
|
||||
const data = await (await fetch(window.constants.BLOG_POST + '/index.json')).json();
|
||||
const data = await (await fetch(window.constants.BLOG_POST + '/index.json', { signal: this.controller.signal })).json();
|
||||
|
||||
if (this.controller.signal.aborted === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
title: data.title,
|
||||
@@ -21,15 +26,20 @@ export default class Changelog extends React.PureComponent {
|
||||
author: 'By ' + data.authors.join(', '),
|
||||
html: data.html
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
componentDidMount() {
|
||||
if (localStorage.getItem('offlineMode') === 'true') {
|
||||
return;
|
||||
}
|
||||
|
||||
this.getUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
// stop making requests
|
||||
this.controller.abort();
|
||||
}
|
||||
|
||||
render() {
|
||||
const errorMessage = (msg) => {
|
||||
|
||||
@@ -13,10 +13,15 @@ export default class BackgroundSettings extends React.PureComponent {
|
||||
value: 'loading'
|
||||
}]
|
||||
};
|
||||
this.controller = new AbortController();
|
||||
}
|
||||
|
||||
async getQuoteLanguages() {
|
||||
const data = await (await fetch(window.constants.API_URL + '/quotes/languages')).json();
|
||||
const data = await (await fetch(window.constants.API_URL + '/quotes/languages', { signal: this.controller.signal })).json();
|
||||
|
||||
if (this.controller.signal.aborted === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
let array = [];
|
||||
data.forEach(item => {
|
||||
@@ -35,6 +40,11 @@ export default class BackgroundSettings extends React.PureComponent {
|
||||
this.getQuoteLanguages();
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
// stop making requests
|
||||
this.controller.abort();
|
||||
}
|
||||
|
||||
render() {
|
||||
const language = window.language.modals.main.settings.sections.language;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user