Skip to content

[8.19] [Rules] Fixed infinite loop bug in investigation guide editor (#240472)#241068

Merged
kibanamachine merged 2 commits intoelastic:8.19from
kibanamachine:backport/8.19/pr-240472
Oct 29, 2025
Merged

[8.19] [Rules] Fixed infinite loop bug in investigation guide editor (#240472)#241068
kibanamachine merged 2 commits intoelastic:8.19from
kibanamachine:backport/8.19/pr-240472

Conversation

@kibanamachine
Copy link
Contributor

Backport

This will backport the following commits from main to 8.19:

Questions ?

Please refer to the Backport tool documentation

…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 kibanamachine added the backport This PR is a backport of another PR label Oct 29, 2025
@kibanamachine kibanamachine enabled auto-merge (squash) October 29, 2025 08:05
@kibanamachine kibanamachine merged commit 878f6fe into elastic:8.19 Oct 29, 2025
8 checks passed
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
apm 2015 2017 +2
datasetQuality 710 712 +2
discover 1438 1440 +2
infra 1773 1775 +2
ml 2568 2570 +2
monitoring 835 837 +2
observability 1437 1439 +2
observabilityLogsExplorer 522 524 +2
slo 1314 1316 +2
synthetics 1367 1369 +2
transform 819 821 +2
triggersActionsUi 1000 1002 +2
uptime 900 902 +2
total +26

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
apm 2.8MB 2.8MB +13.0B
datasetQuality 443.2KB 443.2KB +15.0B
discover 1.1MB 1.1MB +11.0B
infra 1.6MB 1.6MB +19.0B
ml 5.6MB 5.6MB +13.0B
monitoring 689.1KB 689.1KB +13.0B
observability 1.4MB 1.4MB +60.0B
observabilityLogsExplorer 291.3KB 291.3KB +13.0B
slo 1014.2KB 1014.2KB +13.0B
synthetics 1.0MB 1.0MB +13.0B
transform 656.4KB 656.4KB +13.0B
triggersActionsUi 1.6MB 1.6MB +59.0B
uptime 511.2KB 511.2KB +13.0B
total +268.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
kbnUiSharedDeps-srcJs 3.7MB 3.7MB -129.0B

cc @cesco-f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

3 participants