Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rossoha opened this issue Dec 26, 2021 · 0 comments
Open
Milestone

Comments

@rossoha
Copy link

rossoha commented Dec 26, 2021

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants