Skip to content

Commit 48fb7f2

Browse files
authored
Fix: Resolve [object Object] displaying in browser tab title on workflow instance page (#1911)
* fix(orchestrator): use t() instead of Trans component for page title The Trans component returns an element which becomes [object Object] when used as the browser tab title. Using the t() function directly returns a string, fixing the issue while maintaining i18n support. * fix(orchestrator): use t() instead of Trans component for page title The Trans component returns an element which becomes [object Object] when used as the browser tab title. Using t() directly returns a string, fixing the issue while maintaining i18n support. * chore: apply prettier formatting to WorkflowInstancePage.tsx
1 parent fcefd94 commit 48fb7f2

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@red-hat-developer-hub/backstage-plugin-orchestrator': patch
3+
---
4+
5+
Fix browser tab showing `[object Object]` on workflow instance page
6+
7+
Replace `<Trans>` component with `t()` function for page title to ensure a string is returned instead of an element, which was causing `[object Object]` to appear in the browser tab title.

workspaces/orchestrator/plugins/orchestrator/src/components/WorkflowInstancePage/WorkflowInstancePage.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ import { orchestratorTranslationRef } from '../../translations';
7575
import { deepSearchObject } from '../../utils/deepSearchObject';
7676
import { isNonNullable } from '../../utils/TypeGuards';
7777
import { buildUrl } from '../../utils/UrlUtils';
78-
import { Trans } from '../Trans';
7978
import { BaseOrchestratorPage } from '../ui/BaseOrchestratorPage';
8079
import { InfoDialog } from '../ui/InfoDialog';
8180
import { WorkflowInstancePageContent } from './WorkflowInstancePageContent';
@@ -391,12 +390,9 @@ export const WorkflowInstancePage = () => {
391390

392391
const combinedError: Error | undefined = error || inputSchemaError;
393392

394-
const title = (
395-
<Trans
396-
message="run.pageTitle"
397-
params={{ processName: value?.processName }}
398-
/>
399-
) as unknown as string;
393+
const title = t('run.pageTitle', {
394+
processName: value?.processName ?? '',
395+
});
400396

401397
return (
402398
<BaseOrchestratorPage title={title}>

0 commit comments

Comments
 (0)