[Rules] Fixed infinite loop bug in investigation guide editor#240472
Merged
cesco-f merged 15 commits intoelastic:mainfrom Oct 29, 2025
Merged
[Rules] Fixed infinite loop bug in investigation guide editor#240472cesco-f merged 15 commits intoelastic:mainfrom
cesco-f merged 15 commits intoelastic:mainfrom
Conversation
Contributor
Author
|
/ci |
cnasikas
approved these changes
Oct 27, 2025
jcger
approved these changes
Oct 27, 2025
…t --include-path /api/status --include-path /api/alerting/rule/ --include-path /api/alerting/rules --include-path /api/actions --include-path /api/security/role --include-path /api/spaces --include-path /api/streams --include-path /api/fleet --include-path /api/saved_objects/_import --include-path /api/saved_objects/_export --include-path /api/maintenance_window --include-path /api/agent_builder --update'
cesco-f
commented
Oct 27, 2025
x-pack/platform/plugins/shared/alerting/common/routes/rule/request/schemas/v1.ts
Outdated
Show resolved
Hide resolved
florent-leborgne
approved these changes
Oct 27, 2025
.../packages/shared/response-ops/rule_form/src/rule_details/rule_investigation_guide_editor.tsx
Outdated
Show resolved
Hide resolved
…urce-definitions/scripts/fix-location-collection.ts'
8299324 to
1a88a3d
Compare
33429a6 to
7f520b4
Compare
cesco-f
commented
Oct 27, 2025
| } | ||
| }, | ||
| [errorMessages] | ||
| [errorMessages.length] |
Contributor
Author
7f520b4 to
d4c6cfe
Compare
Contributor
💛 Build succeeded, but was flaky
Failed CI Steps
Metrics [docs]Module Count
Async chunks
History
|
Contributor
|
Starting backport for target branches: 8.19, 9.1, 9.2 |
kibanamachine
added a commit
to kibanamachine/kibana
that referenced
this pull request
Oct 29, 2025
…c#240472) When `length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH` this code was constantly setting a new `errorMessages` causing a `Maximum update depth exceeded` error. In this PR we also set a new value for `MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH`. ``` const [errorMessages, setErrorMessages] = React.useState<string[]>([]); const onParse = useCallback( (_: EuiMarkdownParseError | null, { ast }: { ast: EuiMarkdownAstNode }) => { const length = ast.position?.end.offset ?? 0; if (length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH) { setErrorMessages([ i18n.translate('responseOpsRuleForm.investigationGuide.editor.errorMessage', { defaultMessage: 'The Investigation Guide is too long. Please shorten it.\nCurrent length: {length}.\nMax length: {maxLength}.', values: { length, maxLength: MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH }, }), ]); } else if (errorMessages.length) { setErrorMessages([]); } }, [errorMessages] ); ``` Before: https://github.com/user-attachments/assets/5a07984c-f9bf-4938-b31b-c4375558dca9 After: https://github.com/user-attachments/assets/a7f1f132-6e1f-41df-9320-6a0abe2041a4 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 4e74c80)
kibanamachine
added a commit
to kibanamachine/kibana
that referenced
this pull request
Oct 29, 2025
…c#240472) When `length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH` this code was constantly setting a new `errorMessages` causing a `Maximum update depth exceeded` error. In this PR we also set a new value for `MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH`. ``` const [errorMessages, setErrorMessages] = React.useState<string[]>([]); const onParse = useCallback( (_: EuiMarkdownParseError | null, { ast }: { ast: EuiMarkdownAstNode }) => { const length = ast.position?.end.offset ?? 0; if (length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH) { setErrorMessages([ i18n.translate('responseOpsRuleForm.investigationGuide.editor.errorMessage', { defaultMessage: 'The Investigation Guide is too long. Please shorten it.\nCurrent length: {length}.\nMax length: {maxLength}.', values: { length, maxLength: MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH }, }), ]); } else if (errorMessages.length) { setErrorMessages([]); } }, [errorMessages] ); ``` Before: https://github.com/user-attachments/assets/5a07984c-f9bf-4938-b31b-c4375558dca9 After: https://github.com/user-attachments/assets/a7f1f132-6e1f-41df-9320-6a0abe2041a4 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 4e74c80)
kibanamachine
added a commit
to kibanamachine/kibana
that referenced
this pull request
Oct 29, 2025
…c#240472) When `length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH` this code was constantly setting a new `errorMessages` causing a `Maximum update depth exceeded` error. In this PR we also set a new value for `MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH`. ``` const [errorMessages, setErrorMessages] = React.useState<string[]>([]); const onParse = useCallback( (_: EuiMarkdownParseError | null, { ast }: { ast: EuiMarkdownAstNode }) => { const length = ast.position?.end.offset ?? 0; if (length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH) { setErrorMessages([ i18n.translate('responseOpsRuleForm.investigationGuide.editor.errorMessage', { defaultMessage: 'The Investigation Guide is too long. Please shorten it.\nCurrent length: {length}.\nMax length: {maxLength}.', values: { length, maxLength: MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH }, }), ]); } else if (errorMessages.length) { setErrorMessages([]); } }, [errorMessages] ); ``` Before: https://github.com/user-attachments/assets/5a07984c-f9bf-4938-b31b-c4375558dca9 After: https://github.com/user-attachments/assets/a7f1f132-6e1f-41df-9320-6a0abe2041a4 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 4e74c80)
Contributor
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
kibanamachine
added a commit
that referenced
this pull request
Oct 29, 2025
…240472) (#241069) # Backport This will backport the following commits from `main` to `9.1`: - [[Rules] Fixed infinite loop bug in investigation guide editor (#240472)](#240472) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Francesco Fagnani","email":"fagnani.francesco@gmail.com"},"sourceCommit":{"committedDate":"2025-10-29T07:57:02Z","message":"[Rules] Fixed infinite loop bug in investigation guide editor (#240472)\n\nWhen `length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH` this code was\nconstantly setting a new `errorMessages` causing a `Maximum update depth\nexceeded` error.\n\nIn this PR we also set a new value for\n`MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH`.\n\n```\n const [errorMessages, setErrorMessages] = React.useState<string[]>([]);\n const onParse = useCallback(\n (_: EuiMarkdownParseError | null, { ast }: { ast: EuiMarkdownAstNode }) => {\n const length = ast.position?.end.offset ?? 0;\n if (length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH) {\n setErrorMessages([\n i18n.translate('responseOpsRuleForm.investigationGuide.editor.errorMessage', {\n defaultMessage:\n 'The Investigation Guide is too long. Please shorten it.\\nCurrent length: {length}.\\nMax length: {maxLength}.',\n values: { length, maxLength: MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH },\n }),\n ]);\n } else if (errorMessages.length) {\n setErrorMessages([]);\n }\n },\n [errorMessages]\n );\n```\n\nBefore:\n\n\nhttps://github.com/user-attachments/assets/5a07984c-f9bf-4938-b31b-c4375558dca9\n\nAfter:\n\n\nhttps://github.com/user-attachments/assets/a7f1f132-6e1f-41df-9320-6a0abe2041a4\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"4e74c80733d4aa53800204146f667771371ba158","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","backport:version","author:obs-ux-management","v9.3.0","v8.19.7","v9.1.7","v9.2.1"],"title":"[Rules] Fixed infinite loop bug in investigation guide editor","number":240472,"url":"https://github.com/elastic/kibana/pull/240472","mergeCommit":{"message":"[Rules] Fixed infinite loop bug in investigation guide editor (#240472)\n\nWhen `length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH` this code was\nconstantly setting a new `errorMessages` causing a `Maximum update depth\nexceeded` error.\n\nIn this PR we also set a new value for\n`MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH`.\n\n```\n const [errorMessages, setErrorMessages] = React.useState<string[]>([]);\n const onParse = useCallback(\n (_: EuiMarkdownParseError | null, { ast }: { ast: EuiMarkdownAstNode }) => {\n const length = ast.position?.end.offset ?? 0;\n if (length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH) {\n setErrorMessages([\n i18n.translate('responseOpsRuleForm.investigationGuide.editor.errorMessage', {\n defaultMessage:\n 'The Investigation Guide is too long. Please shorten it.\\nCurrent length: {length}.\\nMax length: {maxLength}.',\n values: { length, maxLength: MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH },\n }),\n ]);\n } else if (errorMessages.length) {\n setErrorMessages([]);\n }\n },\n [errorMessages]\n );\n```\n\nBefore:\n\n\nhttps://github.com/user-attachments/assets/5a07984c-f9bf-4938-b31b-c4375558dca9\n\nAfter:\n\n\nhttps://github.com/user-attachments/assets/a7f1f132-6e1f-41df-9320-6a0abe2041a4\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"4e74c80733d4aa53800204146f667771371ba158"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.1","9.2"],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/240472","number":240472,"mergeCommit":{"message":"[Rules] Fixed infinite loop bug in investigation guide editor (#240472)\n\nWhen `length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH` this code was\nconstantly setting a new `errorMessages` causing a `Maximum update depth\nexceeded` error.\n\nIn this PR we also set a new value for\n`MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH`.\n\n```\n const [errorMessages, setErrorMessages] = React.useState<string[]>([]);\n const onParse = useCallback(\n (_: EuiMarkdownParseError | null, { ast }: { ast: EuiMarkdownAstNode }) => {\n const length = ast.position?.end.offset ?? 0;\n if (length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH) {\n setErrorMessages([\n i18n.translate('responseOpsRuleForm.investigationGuide.editor.errorMessage', {\n defaultMessage:\n 'The Investigation Guide is too long. Please shorten it.\\nCurrent length: {length}.\\nMax length: {maxLength}.',\n values: { length, maxLength: MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH },\n }),\n ]);\n } else if (errorMessages.length) {\n setErrorMessages([]);\n }\n },\n [errorMessages]\n );\n```\n\nBefore:\n\n\nhttps://github.com/user-attachments/assets/5a07984c-f9bf-4938-b31b-c4375558dca9\n\nAfter:\n\n\nhttps://github.com/user-attachments/assets/a7f1f132-6e1f-41df-9320-6a0abe2041a4\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"4e74c80733d4aa53800204146f667771371ba158"}},{"branch":"8.19","label":"v8.19.7","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.1","label":"v9.1.7","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.2","label":"v9.2.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> --------- Co-authored-by: Francesco Fagnani <fagnani.francesco@gmail.com>
kibanamachine
added a commit
that referenced
this pull request
Oct 29, 2025
…240472) (#241070) # Backport This will backport the following commits from `main` to `9.2`: - [[Rules] Fixed infinite loop bug in investigation guide editor (#240472)](#240472) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Francesco Fagnani","email":"fagnani.francesco@gmail.com"},"sourceCommit":{"committedDate":"2025-10-29T07:57:02Z","message":"[Rules] Fixed infinite loop bug in investigation guide editor (#240472)\n\nWhen `length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH` this code was\nconstantly setting a new `errorMessages` causing a `Maximum update depth\nexceeded` error.\n\nIn this PR we also set a new value for\n`MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH`.\n\n```\n const [errorMessages, setErrorMessages] = React.useState<string[]>([]);\n const onParse = useCallback(\n (_: EuiMarkdownParseError | null, { ast }: { ast: EuiMarkdownAstNode }) => {\n const length = ast.position?.end.offset ?? 0;\n if (length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH) {\n setErrorMessages([\n i18n.translate('responseOpsRuleForm.investigationGuide.editor.errorMessage', {\n defaultMessage:\n 'The Investigation Guide is too long. Please shorten it.\\nCurrent length: {length}.\\nMax length: {maxLength}.',\n values: { length, maxLength: MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH },\n }),\n ]);\n } else if (errorMessages.length) {\n setErrorMessages([]);\n }\n },\n [errorMessages]\n );\n```\n\nBefore:\n\n\nhttps://github.com/user-attachments/assets/5a07984c-f9bf-4938-b31b-c4375558dca9\n\nAfter:\n\n\nhttps://github.com/user-attachments/assets/a7f1f132-6e1f-41df-9320-6a0abe2041a4\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"4e74c80733d4aa53800204146f667771371ba158","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","backport:version","author:obs-ux-management","v9.3.0","v8.19.7","v9.1.7","v9.2.1"],"title":"[Rules] Fixed infinite loop bug in investigation guide editor","number":240472,"url":"https://github.com/elastic/kibana/pull/240472","mergeCommit":{"message":"[Rules] Fixed infinite loop bug in investigation guide editor (#240472)\n\nWhen `length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH` this code was\nconstantly setting a new `errorMessages` causing a `Maximum update depth\nexceeded` error.\n\nIn this PR we also set a new value for\n`MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH`.\n\n```\n const [errorMessages, setErrorMessages] = React.useState<string[]>([]);\n const onParse = useCallback(\n (_: EuiMarkdownParseError | null, { ast }: { ast: EuiMarkdownAstNode }) => {\n const length = ast.position?.end.offset ?? 0;\n if (length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH) {\n setErrorMessages([\n i18n.translate('responseOpsRuleForm.investigationGuide.editor.errorMessage', {\n defaultMessage:\n 'The Investigation Guide is too long. Please shorten it.\\nCurrent length: {length}.\\nMax length: {maxLength}.',\n values: { length, maxLength: MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH },\n }),\n ]);\n } else if (errorMessages.length) {\n setErrorMessages([]);\n }\n },\n [errorMessages]\n );\n```\n\nBefore:\n\n\nhttps://github.com/user-attachments/assets/5a07984c-f9bf-4938-b31b-c4375558dca9\n\nAfter:\n\n\nhttps://github.com/user-attachments/assets/a7f1f132-6e1f-41df-9320-6a0abe2041a4\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"4e74c80733d4aa53800204146f667771371ba158"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.1","9.2"],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/240472","number":240472,"mergeCommit":{"message":"[Rules] Fixed infinite loop bug in investigation guide editor (#240472)\n\nWhen `length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH` this code was\nconstantly setting a new `errorMessages` causing a `Maximum update depth\nexceeded` error.\n\nIn this PR we also set a new value for\n`MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH`.\n\n```\n const [errorMessages, setErrorMessages] = React.useState<string[]>([]);\n const onParse = useCallback(\n (_: EuiMarkdownParseError | null, { ast }: { ast: EuiMarkdownAstNode }) => {\n const length = ast.position?.end.offset ?? 0;\n if (length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH) {\n setErrorMessages([\n i18n.translate('responseOpsRuleForm.investigationGuide.editor.errorMessage', {\n defaultMessage:\n 'The Investigation Guide is too long. Please shorten it.\\nCurrent length: {length}.\\nMax length: {maxLength}.',\n values: { length, maxLength: MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH },\n }),\n ]);\n } else if (errorMessages.length) {\n setErrorMessages([]);\n }\n },\n [errorMessages]\n );\n```\n\nBefore:\n\n\nhttps://github.com/user-attachments/assets/5a07984c-f9bf-4938-b31b-c4375558dca9\n\nAfter:\n\n\nhttps://github.com/user-attachments/assets/a7f1f132-6e1f-41df-9320-6a0abe2041a4\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"4e74c80733d4aa53800204146f667771371ba158"}},{"branch":"8.19","label":"v8.19.7","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.1","label":"v9.1.7","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.2","label":"v9.2.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> --------- Co-authored-by: Francesco Fagnani <fagnani.francesco@gmail.com>
kibanamachine
added a commit
that referenced
this pull request
Oct 29, 2025
…240472) (#241068) # Backport This will backport the following commits from `main` to `8.19`: - [[Rules] Fixed infinite loop bug in investigation guide editor (#240472)](#240472) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Francesco Fagnani","email":"fagnani.francesco@gmail.com"},"sourceCommit":{"committedDate":"2025-10-29T07:57:02Z","message":"[Rules] Fixed infinite loop bug in investigation guide editor (#240472)\n\nWhen `length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH` this code was\nconstantly setting a new `errorMessages` causing a `Maximum update depth\nexceeded` error.\n\nIn this PR we also set a new value for\n`MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH`.\n\n```\n const [errorMessages, setErrorMessages] = React.useState<string[]>([]);\n const onParse = useCallback(\n (_: EuiMarkdownParseError | null, { ast }: { ast: EuiMarkdownAstNode }) => {\n const length = ast.position?.end.offset ?? 0;\n if (length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH) {\n setErrorMessages([\n i18n.translate('responseOpsRuleForm.investigationGuide.editor.errorMessage', {\n defaultMessage:\n 'The Investigation Guide is too long. Please shorten it.\\nCurrent length: {length}.\\nMax length: {maxLength}.',\n values: { length, maxLength: MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH },\n }),\n ]);\n } else if (errorMessages.length) {\n setErrorMessages([]);\n }\n },\n [errorMessages]\n );\n```\n\nBefore:\n\n\nhttps://github.com/user-attachments/assets/5a07984c-f9bf-4938-b31b-c4375558dca9\n\nAfter:\n\n\nhttps://github.com/user-attachments/assets/a7f1f132-6e1f-41df-9320-6a0abe2041a4\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"4e74c80733d4aa53800204146f667771371ba158","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","backport:version","author:obs-ux-management","v9.3.0","v8.19.7","v9.1.7","v9.2.1"],"title":"[Rules] Fixed infinite loop bug in investigation guide editor","number":240472,"url":"https://github.com/elastic/kibana/pull/240472","mergeCommit":{"message":"[Rules] Fixed infinite loop bug in investigation guide editor (#240472)\n\nWhen `length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH` this code was\nconstantly setting a new `errorMessages` causing a `Maximum update depth\nexceeded` error.\n\nIn this PR we also set a new value for\n`MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH`.\n\n```\n const [errorMessages, setErrorMessages] = React.useState<string[]>([]);\n const onParse = useCallback(\n (_: EuiMarkdownParseError | null, { ast }: { ast: EuiMarkdownAstNode }) => {\n const length = ast.position?.end.offset ?? 0;\n if (length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH) {\n setErrorMessages([\n i18n.translate('responseOpsRuleForm.investigationGuide.editor.errorMessage', {\n defaultMessage:\n 'The Investigation Guide is too long. Please shorten it.\\nCurrent length: {length}.\\nMax length: {maxLength}.',\n values: { length, maxLength: MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH },\n }),\n ]);\n } else if (errorMessages.length) {\n setErrorMessages([]);\n }\n },\n [errorMessages]\n );\n```\n\nBefore:\n\n\nhttps://github.com/user-attachments/assets/5a07984c-f9bf-4938-b31b-c4375558dca9\n\nAfter:\n\n\nhttps://github.com/user-attachments/assets/a7f1f132-6e1f-41df-9320-6a0abe2041a4\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"4e74c80733d4aa53800204146f667771371ba158"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.1","9.2"],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/240472","number":240472,"mergeCommit":{"message":"[Rules] Fixed infinite loop bug in investigation guide editor (#240472)\n\nWhen `length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH` this code was\nconstantly setting a new `errorMessages` causing a `Maximum update depth\nexceeded` error.\n\nIn this PR we also set a new value for\n`MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH`.\n\n```\n const [errorMessages, setErrorMessages] = React.useState<string[]>([]);\n const onParse = useCallback(\n (_: EuiMarkdownParseError | null, { ast }: { ast: EuiMarkdownAstNode }) => {\n const length = ast.position?.end.offset ?? 0;\n if (length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH) {\n setErrorMessages([\n i18n.translate('responseOpsRuleForm.investigationGuide.editor.errorMessage', {\n defaultMessage:\n 'The Investigation Guide is too long. Please shorten it.\\nCurrent length: {length}.\\nMax length: {maxLength}.',\n values: { length, maxLength: MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH },\n }),\n ]);\n } else if (errorMessages.length) {\n setErrorMessages([]);\n }\n },\n [errorMessages]\n );\n```\n\nBefore:\n\n\nhttps://github.com/user-attachments/assets/5a07984c-f9bf-4938-b31b-c4375558dca9\n\nAfter:\n\n\nhttps://github.com/user-attachments/assets/a7f1f132-6e1f-41df-9320-6a0abe2041a4\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"4e74c80733d4aa53800204146f667771371ba158"}},{"branch":"8.19","label":"v8.19.7","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.1","label":"v9.1.7","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.2","label":"v9.2.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> --------- Co-authored-by: Francesco Fagnani <fagnani.francesco@gmail.com>
tkajtoch
pushed a commit
to tkajtoch/kibana
that referenced
this pull request
Oct 29, 2025
…c#240472) When `length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH` this code was constantly setting a new `errorMessages` causing a `Maximum update depth exceeded` error. In this PR we also set a new value for `MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH`. ``` const [errorMessages, setErrorMessages] = React.useState<string[]>([]); const onParse = useCallback( (_: EuiMarkdownParseError | null, { ast }: { ast: EuiMarkdownAstNode }) => { const length = ast.position?.end.offset ?? 0; if (length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH) { setErrorMessages([ i18n.translate('responseOpsRuleForm.investigationGuide.editor.errorMessage', { defaultMessage: 'The Investigation Guide is too long. Please shorten it.\nCurrent length: {length}.\nMax length: {maxLength}.', values: { length, maxLength: MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH }, }), ]); } else if (errorMessages.length) { setErrorMessages([]); } }, [errorMessages] ); ``` Before: https://github.com/user-attachments/assets/5a07984c-f9bf-4938-b31b-c4375558dca9 After: https://github.com/user-attachments/assets/a7f1f132-6e1f-41df-9320-6a0abe2041a4 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
qn895
pushed a commit
to qn895/kibana
that referenced
this pull request
Oct 30, 2025
…c#240472) When `length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH` this code was constantly setting a new `errorMessages` causing a `Maximum update depth exceeded` error. In this PR we also set a new value for `MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH`. ``` const [errorMessages, setErrorMessages] = React.useState<string[]>([]); const onParse = useCallback( (_: EuiMarkdownParseError | null, { ast }: { ast: EuiMarkdownAstNode }) => { const length = ast.position?.end.offset ?? 0; if (length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH) { setErrorMessages([ i18n.translate('responseOpsRuleForm.investigationGuide.editor.errorMessage', { defaultMessage: 'The Investigation Guide is too long. Please shorten it.\nCurrent length: {length}.\nMax length: {maxLength}.', values: { length, maxLength: MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH }, }), ]); } else if (errorMessages.length) { setErrorMessages([]); } }, [errorMessages] ); ``` Before: https://github.com/user-attachments/assets/5a07984c-f9bf-4938-b31b-c4375558dca9 After: https://github.com/user-attachments/assets/a7f1f132-6e1f-41df-9320-6a0abe2041a4 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
ana-davydova
pushed a commit
to ana-davydova/kibana
that referenced
this pull request
Nov 3, 2025
…c#240472) When `length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH` this code was constantly setting a new `errorMessages` causing a `Maximum update depth exceeded` error. In this PR we also set a new value for `MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH`. ``` const [errorMessages, setErrorMessages] = React.useState<string[]>([]); const onParse = useCallback( (_: EuiMarkdownParseError | null, { ast }: { ast: EuiMarkdownAstNode }) => { const length = ast.position?.end.offset ?? 0; if (length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH) { setErrorMessages([ i18n.translate('responseOpsRuleForm.investigationGuide.editor.errorMessage', { defaultMessage: 'The Investigation Guide is too long. Please shorten it.\nCurrent length: {length}.\nMax length: {maxLength}.', values: { length, maxLength: MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH }, }), ]); } else if (errorMessages.length) { setErrorMessages([]); } }, [errorMessages] ); ``` Before: https://github.com/user-attachments/assets/5a07984c-f9bf-4938-b31b-c4375558dca9 After: https://github.com/user-attachments/assets/a7f1f132-6e1f-41df-9320-6a0abe2041a4 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
albertoblaz
pushed a commit
to albertoblaz/kibana
that referenced
this pull request
Nov 4, 2025
…c#240472) When `length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH` this code was constantly setting a new `errorMessages` causing a `Maximum update depth exceeded` error. In this PR we also set a new value for `MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH`. ``` const [errorMessages, setErrorMessages] = React.useState<string[]>([]); const onParse = useCallback( (_: EuiMarkdownParseError | null, { ast }: { ast: EuiMarkdownAstNode }) => { const length = ast.position?.end.offset ?? 0; if (length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH) { setErrorMessages([ i18n.translate('responseOpsRuleForm.investigationGuide.editor.errorMessage', { defaultMessage: 'The Investigation Guide is too long. Please shorten it.\nCurrent length: {length}.\nMax length: {maxLength}.', values: { length, maxLength: MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH }, }), ]); } else if (errorMessages.length) { setErrorMessages([]); } }, [errorMessages] ); ``` Before: https://github.com/user-attachments/assets/5a07984c-f9bf-4938-b31b-c4375558dca9 After: https://github.com/user-attachments/assets/a7f1f132-6e1f-41df-9320-6a0abe2041a4 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTHthis code was constantly setting a newerrorMessagescausing aMaximum update depth exceedederror.In this PR we also set a new value for
MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH.Before:
Screen.Recording.2025-10-24.at.17.25.19.mov
After:
Screen.Recording.2025-10-24.at.17.25.46.mov