-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.x] [Lens] Correctly use UserMessage longMessage as function (#192492…
…) (#196194) # Backport This will backport the following commits from `main` to `8.x`: - [[Lens] Correctly use UserMessage longMessage as function (#192492)](#192492) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Marco Vettorello","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-14T17:34:36Z","message":"[Lens] Correctly use UserMessage longMessage as function (#192492)\n\n## Summary\r\n\r\nAfter #167205 was merged, the\r\n`UserMessage.longMessage` was typed as `longMessage: string |\r\nReact.ReactNode | ((closePopover: () => void) => React.ReactNode);`\r\n\r\nWith the upcoming React 18 upgrade, an error will become visible because\r\n`((closePopover: () => void) => React.ReactNode);` can't be used as a\r\nReactNode but it correctly needs to be called.\r\n\r\nIn this PR I've made the `closePopover` function being optional (to\r\nsimplify the refactoring) and I've added the typecheck where needed.","sha":"e35507a27d9c8df3fe5947c7227d6072d007dfa5","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Feature:Lens","v9.0.0","backport:prev-minor","v8.16.0"],"title":"[Lens] Correctly use UserMessage longMessage as function ","number":192492,"url":"https://github.com/elastic/kibana/pull/192492","mergeCommit":{"message":"[Lens] Correctly use UserMessage longMessage as function (#192492)\n\n## Summary\r\n\r\nAfter #167205 was merged, the\r\n`UserMessage.longMessage` was typed as `longMessage: string |\r\nReact.ReactNode | ((closePopover: () => void) => React.ReactNode);`\r\n\r\nWith the upcoming React 18 upgrade, an error will become visible because\r\n`((closePopover: () => void) => React.ReactNode);` can't be used as a\r\nReactNode but it correctly needs to be called.\r\n\r\nIn this PR I've made the `closePopover` function being optional (to\r\nsimplify the refactoring) and I've added the typecheck where needed.","sha":"e35507a27d9c8df3fe5947c7227d6072d007dfa5"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/192492","number":192492,"mergeCommit":{"message":"[Lens] Correctly use UserMessage longMessage as function (#192492)\n\n## Summary\r\n\r\nAfter #167205 was merged, the\r\n`UserMessage.longMessage` was typed as `longMessage: string |\r\nReact.ReactNode | ((closePopover: () => void) => React.ReactNode);`\r\n\r\nWith the upcoming React 18 upgrade, an error will become visible because\r\n`((closePopover: () => void) => React.ReactNode);` can't be used as a\r\nReactNode but it correctly needs to be called.\r\n\r\nIn this PR I've made the `closePopover` function being optional (to\r\nsimplify the refactoring) and I've added the typecheck where needed.","sha":"e35507a27d9c8df3fe5947c7227d6072d007dfa5"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Marco Vettorello <[email protected]>
- Loading branch information
1 parent
d48190e
commit 7e8d54c
Showing
11 changed files
with
56 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { UserMessage } from './types'; | ||
|
||
export function getLongMessage(msg: UserMessage) { | ||
return typeof msg.longMessage === 'function' ? msg.longMessage() : msg.longMessage; | ||
} |