Skip to content

Commit

Permalink
STCOR-767 restore correct page titles (#1539)
Browse files Browse the repository at this point in the history
PR #1532 inadvertently undid the work of PR #1377. This restores it.

Refs STCOR-767, STCOR-875
  • Loading branch information
zburke authored Sep 24, 2024
1 parent 181b42a commit 3971b49
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/components/TitleManager/TitleManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3971b49

Please sign in to comment.