Skip to content
This repository was archived by the owner on Jul 21, 2025. It is now read-only.

openScreen leads to Error: An id must be provided to format a message #897

@rossoha

Description

@rossoha

When we calling openScreen it leads to error because:
openScreen calls redirect(route) that contains:
const targetScreen = getMenuItems().find((x: any) => x.menuLink === to) - returns undefined ( we don't add screen to menu )

setWindowTitle(targetScreen?.caption || '') - passes empty string to setWindowTitle that has:

export const setWindowTitle = (value: string) => {
if (titleFormatter == null) {
  return
}

document.title = titleFormatter(value)
}

The quick fix would be to pass null to setWindowTitle instead of an empty string.

Uncaught Error: [@formatjs/intl] An `id` must be provided to format a message. You can either:
1. Configure your build toolchain with [babel-plugin-formatjs](https://formatjs.io/docs/tooling/babel-plugin)
or [@formatjs/ts-transformer](https://formatjs.io/docs/tooling/ts-transformer) OR
2. Configure your `eslint` config to include [eslint-plugin-formatjs](https://formatjs.io/docs/tooling/linter#enforce-id)
to autofix this issue
    at invariant (utils.js:76)
    at formatMessage (message.js:31)
    at formatMessage (provider.js:44)
    at index.esm.js:1919
    at setWindowTitle (index.esm.js:9602)
    at redirect (index.esm.js:9627)
    at openScreen (index.esm.js:393)
    at onClick (TourCard.tsx:67)
    at HTMLUnknownElement.callCallback (react-dom.development.js:3945)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:3994)
    at invokeGuardedCallback (react-dom.development.js:4056)
    at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:4070)
    at executeDispatch (react-dom.development.js:8243)
    at processDispatchQueueItemsInOrder (react-dom.development.js:8275)
    at processDispatchQueue (react-dom.development.js:8288)
    at dispatchEventsForPlugins (react-dom.development.js:8299)
    at react-dom.development.js:8508
    at batchedEventUpdates$1 (react-dom.development.js:22396)
    at batchedEventUpdates (react-dom.development.js:3745)
    at dispatchEventForPluginEventSystem (react-dom.development.js:8507)
    at attemptToDispatchEvent (react-dom.development.js:6005)
    at dispatchEvent (react-dom.development.js:5924)
    at unstable_runWithPriority (scheduler.development.js:468)
    at runWithPriority$1 (react-dom.development.js:11276)
    at discreteUpdates$1 (react-dom.development.js:22413)
    at discreteUpdates (react-dom.development.js:3756)
    at dispatchDiscreteEvent (react-dom.development.js:5889)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions