diff --git a/src/components/TitleManager/TitleManager.js b/src/components/TitleManager/TitleManager.js index 6058724e7..bd09a8e5e 100644 --- a/src/components/TitleManager/TitleManager.js +++ b/src/components/TitleManager/TitleManager.js @@ -21,15 +21,25 @@ class TitleManager extends React.Component { static defaultProps = { prefix: '' } renderTitle = (currentTitle) => { - const { prefix, page, record } = this.props; + const { prefix, page, record, stripes } = this.props; + const postfix = stripes.config?.platformName || APP; if (typeof currentTitle !== 'string') return ''; const tokens = currentTitle.split(' - '); + + /** + * When there are 2 items - that means there are page and postfix. + * If we don't clear the tokens[1] item then we'll have two postfixes - in tokens[1] and tokens[2] will be added later + */ + if (tokens.length === 2) { + tokens[1] = ''; + } + if (page) tokens[0] = page; if (record) tokens[1] = record; - tokens[2] = (this.props.stripes.config || {}).platformName || APP; + tokens[2] = postfix; return prefix + tokens .filter(t => t)