refactor: should use useDocumentTitle to change document title (#2137)
This commit is contained in:
parent
dd3e872b06
commit
73dfe074d7
@ -9,7 +9,6 @@ import { useACLRoleContext } from '../acl/ACLProvider';
|
||||
import { ACLPane } from '../acl/ACLShortcut';
|
||||
import { useRequest } from '../api-client';
|
||||
import { CollectionManagerPane } from '../collection-manager';
|
||||
import { useDocumentTitle } from '../document-title';
|
||||
import { Icon } from '../icon';
|
||||
import { RouteSwitchContext } from '../route-switch';
|
||||
import { useCompile } from '../schema-component';
|
||||
@ -113,7 +112,6 @@ const PluginList = (props) => {
|
||||
const params = useParams<any>();
|
||||
const navigate = useNavigate();
|
||||
const { tabName = 'local' } = params;
|
||||
const { setTitle } = useDocumentTitle();
|
||||
const { t } = useTranslation();
|
||||
const { snippets = [] } = useACLRoleContext();
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { css, cx } from '@emotion/css';
|
||||
import { SortableItem, useCompile, useDesigner } from '@nocobase/client';
|
||||
import { useField } from '@formily/react';
|
||||
import { SortableItem, useCompile, useDesigner, useDocumentTitle } from '@nocobase/client';
|
||||
import { NavBar, NavBarProps } from 'antd-mobile';
|
||||
import React, { useEffect } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { HeaderDesigner } from './Header.Designer';
|
||||
import { useField } from '@formily/react';
|
||||
import { generateNTemplate } from '../../../../locale';
|
||||
import { HeaderDesigner } from './Header.Designer';
|
||||
|
||||
export interface HeaderProps extends NavBarProps {
|
||||
title?: string;
|
||||
@ -18,10 +18,11 @@ const InternalHeader = (props: HeaderProps) => {
|
||||
const compile = useCompile();
|
||||
const compiledTitle = compile(title);
|
||||
const navigate = useNavigate();
|
||||
const { setTitle } = useDocumentTitle();
|
||||
|
||||
useEffect(() => {
|
||||
// sync title
|
||||
document.title = `${compiledTitle} - NocoBase`;
|
||||
setTitle(compiledTitle);
|
||||
}, [compiledTitle]);
|
||||
|
||||
return (
|
||||
|
Loading…
Reference in New Issue
Block a user