Page Title: Sync setting between tabs (#2751)
This commit is contained in:
parent
27842a1cf3
commit
4090cf093d
1
package-lock.json
generated
1
package-lock.json
generated
@ -105,7 +105,6 @@
|
||||
}
|
||||
},
|
||||
"dev/eslint-multitab": {
|
||||
"name": "eslint-plugin-eslint-multitab-tt",
|
||||
"version": "0.0.0",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
|
||||
@ -74,7 +74,6 @@ const SettingsPrivacy: FC<OwnProps & StateProps> = ({
|
||||
loadWebAuthorizations,
|
||||
showNotification,
|
||||
setSettingOption,
|
||||
updatePageTitle,
|
||||
} = getActions();
|
||||
|
||||
useEffect(() => {
|
||||
@ -118,7 +117,6 @@ const SettingsPrivacy: FC<OwnProps & StateProps> = ({
|
||||
setSettingOption({
|
||||
canDisplayChatInTitle: isChecked,
|
||||
});
|
||||
updatePageTitle();
|
||||
}, []);
|
||||
|
||||
const handleUpdateContentSettings = useCallback((isChecked: boolean) => {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { addActionHandler } from '../../index';
|
||||
import { addActionHandler, getActions } from '../../index';
|
||||
import { replaceSettings, replaceThemeSettings } from '../../reducers';
|
||||
import switchTheme from '../../../util/switchTheme';
|
||||
import { ANIMATION_LEVEL_MAX, ANIMATION_LEVEL_MED, ANIMATION_LEVEL_MIN } from '../../../config';
|
||||
@ -12,6 +12,8 @@ import { getCurrentTabId } from '../../../util/establishMultitabRole';
|
||||
let prevGlobal: GlobalState | undefined;
|
||||
|
||||
addCallback((global: GlobalState) => {
|
||||
const { updatePageTitle } = getActions();
|
||||
|
||||
const settings = global.settings.byKey;
|
||||
const prevSettings = prevGlobal?.settings.byKey;
|
||||
prevGlobal = global;
|
||||
@ -48,6 +50,10 @@ addCallback((global: GlobalState) => {
|
||||
document.documentElement.style.setProperty('--message-text-size', `${settings.messageTextSize}px`);
|
||||
document.documentElement.setAttribute('data-message-text-size', settings.messageTextSize.toString());
|
||||
}
|
||||
|
||||
if (settings.canDisplayChatInTitle !== prevSettings.canDisplayChatInTitle) {
|
||||
updatePageTitle();
|
||||
}
|
||||
});
|
||||
|
||||
addActionHandler('setSettingOption', (global, actions, payload): ActionReturnType => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user