[Discover][Query Bar] Enable "Save Query" button after making changes in the save query menu#229053
Conversation
… user did not include the filters
|
/ci |
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#8826[✅] src/platform/test/functional/apps/discover/ccs_compatibility/config.ts: 25/25 tests passed. |
src/platform/test/functional/apps/discover/ccs_compatibility/_saved_queries.ts
Outdated
Show resolved
Hide resolved
99d134c to
bea19a4
Compare
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#8846[✅] src/platform/test/functional/apps/discover/ccs_compatibility/config.ts: 25/25 tests passed. |
|
/ci |
2 similar comments
|
/ci |
|
/ci |
|
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
ThomThomson
left a comment
There was a problem hiding this comment.
Is there any chance we could ammend the comparison logic instead of pre-filling the attributes.filters to an empty array?
If possible, it seems like a safer solution as it couldn't cause any downstream changes.
4bb4ec1 to
f63c50c
Compare
|
@ThomThomson Thank you for your review! I addressed your suggestion in f63c50c. Please let me know if it's okay now |
|
/ci |
💚 Build Succeeded
Metrics [docs]Async chunks
History
|
davismcphee
left a comment
There was a problem hiding this comment.
Tested locally and it works well, thanks for fixing it! And congrats on merging your first Kibana PR 🎉
Just one small request, it looks like the PR description still refers to the previous solution. We should make sure to update it for future reference.
There was a problem hiding this comment.
For context in case you haven't come across it yet, ccs_compatibility stands for cross-cluster search, and it's odd that all our saved query management tests live here 😅 But it does seem like the most appropriate place for this test currently.
ThomThomson
left a comment
There was a problem hiding this comment.
Changes LGTM! Thanks for fixing this!
| const filtersHaveChanged = Boolean( | ||
| savedQuery?.attributes.filters && | ||
| !compareFilters(filters ?? [], savedQuery.attributes.filters, COMPARE_ALL_OPTIONS) | ||
| const filtersHaveChanged = !compareFilters( |
There was a problem hiding this comment.
This looks much better, thank you for making the change!
|
Starting backport for target branches: 8.18, 8.19, 9.0, 9.1 |
… in the save query menu (elastic#229053) ## Summary This PR fixes an issue where the `Save Query` button was disabled after making changes (e.g., adding filters) in the query menu. Currently, a user is unable to click `Save Query` if they previously saved the query with the `Include filters` field unchecked and then added new filters. The problem occurred because we compare the filter state in the useEffect hook. However, if the user saved the query without the `Include filters` option, the in-memory object lacked the `attributes.filters` property entirely. This prevented the comparison from executing correctly and resulted in the logical test always returning `false`. To fix the issue, I removed the `savedQuery?.attributes.filters &&` condition, and provided `[]` as a fallback value for `savedQuery?.attributes.filters` if the filters were not defined. Resolves: elastic#210948 ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [x] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... (cherry picked from commit 43c1ea7)
… in the save query menu (elastic#229053) ## Summary This PR fixes an issue where the `Save Query` button was disabled after making changes (e.g., adding filters) in the query menu. Currently, a user is unable to click `Save Query` if they previously saved the query with the `Include filters` field unchecked and then added new filters. The problem occurred because we compare the filter state in the useEffect hook. However, if the user saved the query without the `Include filters` option, the in-memory object lacked the `attributes.filters` property entirely. This prevented the comparison from executing correctly and resulted in the logical test always returning `false`. To fix the issue, I removed the `savedQuery?.attributes.filters &&` condition, and provided `[]` as a fallback value for `savedQuery?.attributes.filters` if the filters were not defined. Resolves: elastic#210948 ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [x] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... (cherry picked from commit 43c1ea7)
… in the save query menu (elastic#229053) ## Summary This PR fixes an issue where the `Save Query` button was disabled after making changes (e.g., adding filters) in the query menu. Currently, a user is unable to click `Save Query` if they previously saved the query with the `Include filters` field unchecked and then added new filters. The problem occurred because we compare the filter state in the useEffect hook. However, if the user saved the query without the `Include filters` option, the in-memory object lacked the `attributes.filters` property entirely. This prevented the comparison from executing correctly and resulted in the logical test always returning `false`. To fix the issue, I removed the `savedQuery?.attributes.filters &&` condition, and provided `[]` as a fallback value for `savedQuery?.attributes.filters` if the filters were not defined. Resolves: elastic#210948 ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [x] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... (cherry picked from commit 43c1ea7)
… in the save query menu (elastic#229053) ## Summary This PR fixes an issue where the `Save Query` button was disabled after making changes (e.g., adding filters) in the query menu. Currently, a user is unable to click `Save Query` if they previously saved the query with the `Include filters` field unchecked and then added new filters. The problem occurred because we compare the filter state in the useEffect hook. However, if the user saved the query without the `Include filters` option, the in-memory object lacked the `attributes.filters` property entirely. This prevented the comparison from executing correctly and resulted in the logical test always returning `false`. To fix the issue, I removed the `savedQuery?.attributes.filters &&` condition, and provided `[]` as a fallback value for `savedQuery?.attributes.filters` if the filters were not defined. Resolves: elastic#210948 ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [x] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... (cherry picked from commit 43c1ea7)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…hanges in the save query menu (#229053) (#229911) # Backport This will backport the following commits from `main` to `9.1`: - [[Discover][Query Bar] Enable "Save Query" button after making changes in the save query menu (#229053)](#229053) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Miłosz Radzyński","email":"mradzynski.elastic@gmail.com"},"sourceCommit":{"committedDate":"2025-07-30T07:16:45Z","message":"[Discover][Query Bar] Enable \"Save Query\" button after making changes in the save query menu (#229053)\n\n## Summary\n\nThis PR fixes an issue where the `Save Query` button was disabled after\nmaking changes (e.g., adding filters) in the query menu. Currently, a\nuser is unable to click `Save Query` if they previously saved the query\nwith the `Include filters` field unchecked and then added new filters.\n\nThe problem occurred because we compare the filter state in the\nuseEffect hook. However, if the user saved the query without the\n`Include filters` option, the in-memory object lacked the\n`attributes.filters` property entirely. This prevented the comparison\nfrom executing correctly and resulted in the logical test always\nreturning `false`.\n\nTo fix the issue, I removed the `savedQuery?.attributes.filters &&`\ncondition, and provided `[]` as a fallback value for\n`savedQuery?.attributes.filters` if the filters were not defined.\n\nResolves: #210948\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [x] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [x] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n- [ ] ...","sha":"43c1ea7e41bcd8a54af55c14a41287f6ca2911aa","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:DataDiscovery","backport:version","v8.19.0","v9.2.0","v9.0.5","v9.1.1","v8.18.5"],"title":"[Discover][Query Bar] Enable \"Save Query\" button after making changes in the save query menu","number":229053,"url":"https://github.com/elastic/kibana/pull/229053","mergeCommit":{"message":"[Discover][Query Bar] Enable \"Save Query\" button after making changes in the save query menu (#229053)\n\n## Summary\n\nThis PR fixes an issue where the `Save Query` button was disabled after\nmaking changes (e.g., adding filters) in the query menu. Currently, a\nuser is unable to click `Save Query` if they previously saved the query\nwith the `Include filters` field unchecked and then added new filters.\n\nThe problem occurred because we compare the filter state in the\nuseEffect hook. However, if the user saved the query without the\n`Include filters` option, the in-memory object lacked the\n`attributes.filters` property entirely. This prevented the comparison\nfrom executing correctly and resulted in the logical test always\nreturning `false`.\n\nTo fix the issue, I removed the `savedQuery?.attributes.filters &&`\ncondition, and provided `[]` as a fallback value for\n`savedQuery?.attributes.filters` if the filters were not defined.\n\nResolves: #210948\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [x] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [x] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n- [ ] ...","sha":"43c1ea7e41bcd8a54af55c14a41287f6ca2911aa"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.0","9.1","8.18"],"targetPullRequestStates":[{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/229053","number":229053,"mergeCommit":{"message":"[Discover][Query Bar] Enable \"Save Query\" button after making changes in the save query menu (#229053)\n\n## Summary\n\nThis PR fixes an issue where the `Save Query` button was disabled after\nmaking changes (e.g., adding filters) in the query menu. Currently, a\nuser is unable to click `Save Query` if they previously saved the query\nwith the `Include filters` field unchecked and then added new filters.\n\nThe problem occurred because we compare the filter state in the\nuseEffect hook. However, if the user saved the query without the\n`Include filters` option, the in-memory object lacked the\n`attributes.filters` property entirely. This prevented the comparison\nfrom executing correctly and resulted in the logical test always\nreturning `false`.\n\nTo fix the issue, I removed the `savedQuery?.attributes.filters &&`\ncondition, and provided `[]` as a fallback value for\n`savedQuery?.attributes.filters` if the filters were not defined.\n\nResolves: #210948\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [x] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [x] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n- [ ] ...","sha":"43c1ea7e41bcd8a54af55c14a41287f6ca2911aa"}},{"branch":"9.0","label":"v9.0.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.1","label":"v9.1.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Miłosz Radzyński <mradzynski.elastic@gmail.com>
…hanges in the save query menu (#229053) (#229910) # Backport This will backport the following commits from `main` to `9.0`: - [[Discover][Query Bar] Enable "Save Query" button after making changes in the save query menu (#229053)](#229053) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Miłosz Radzyński","email":"mradzynski.elastic@gmail.com"},"sourceCommit":{"committedDate":"2025-07-30T07:16:45Z","message":"[Discover][Query Bar] Enable \"Save Query\" button after making changes in the save query menu (#229053)\n\n## Summary\n\nThis PR fixes an issue where the `Save Query` button was disabled after\nmaking changes (e.g., adding filters) in the query menu. Currently, a\nuser is unable to click `Save Query` if they previously saved the query\nwith the `Include filters` field unchecked and then added new filters.\n\nThe problem occurred because we compare the filter state in the\nuseEffect hook. However, if the user saved the query without the\n`Include filters` option, the in-memory object lacked the\n`attributes.filters` property entirely. This prevented the comparison\nfrom executing correctly and resulted in the logical test always\nreturning `false`.\n\nTo fix the issue, I removed the `savedQuery?.attributes.filters &&`\ncondition, and provided `[]` as a fallback value for\n`savedQuery?.attributes.filters` if the filters were not defined.\n\nResolves: #210948\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [x] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [x] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n- [ ] ...","sha":"43c1ea7e41bcd8a54af55c14a41287f6ca2911aa","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:DataDiscovery","backport:version","v8.19.0","v9.2.0","v9.0.5","v9.1.1","v8.18.5"],"title":"[Discover][Query Bar] Enable \"Save Query\" button after making changes in the save query menu","number":229053,"url":"https://github.com/elastic/kibana/pull/229053","mergeCommit":{"message":"[Discover][Query Bar] Enable \"Save Query\" button after making changes in the save query menu (#229053)\n\n## Summary\n\nThis PR fixes an issue where the `Save Query` button was disabled after\nmaking changes (e.g., adding filters) in the query menu. Currently, a\nuser is unable to click `Save Query` if they previously saved the query\nwith the `Include filters` field unchecked and then added new filters.\n\nThe problem occurred because we compare the filter state in the\nuseEffect hook. However, if the user saved the query without the\n`Include filters` option, the in-memory object lacked the\n`attributes.filters` property entirely. This prevented the comparison\nfrom executing correctly and resulted in the logical test always\nreturning `false`.\n\nTo fix the issue, I removed the `savedQuery?.attributes.filters &&`\ncondition, and provided `[]` as a fallback value for\n`savedQuery?.attributes.filters` if the filters were not defined.\n\nResolves: #210948\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [x] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [x] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n- [ ] ...","sha":"43c1ea7e41bcd8a54af55c14a41287f6ca2911aa"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.0","9.1","8.18"],"targetPullRequestStates":[{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/229053","number":229053,"mergeCommit":{"message":"[Discover][Query Bar] Enable \"Save Query\" button after making changes in the save query menu (#229053)\n\n## Summary\n\nThis PR fixes an issue where the `Save Query` button was disabled after\nmaking changes (e.g., adding filters) in the query menu. Currently, a\nuser is unable to click `Save Query` if they previously saved the query\nwith the `Include filters` field unchecked and then added new filters.\n\nThe problem occurred because we compare the filter state in the\nuseEffect hook. However, if the user saved the query without the\n`Include filters` option, the in-memory object lacked the\n`attributes.filters` property entirely. This prevented the comparison\nfrom executing correctly and resulted in the logical test always\nreturning `false`.\n\nTo fix the issue, I removed the `savedQuery?.attributes.filters &&`\ncondition, and provided `[]` as a fallback value for\n`savedQuery?.attributes.filters` if the filters were not defined.\n\nResolves: #210948\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [x] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [x] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n- [ ] ...","sha":"43c1ea7e41bcd8a54af55c14a41287f6ca2911aa"}},{"branch":"9.0","label":"v9.0.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.1","label":"v9.1.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Miłosz Radzyński <mradzynski.elastic@gmail.com>
…changes in the save query menu (#229053) (#229909) # Backport This will backport the following commits from `main` to `8.19`: - [[Discover][Query Bar] Enable "Save Query" button after making changes in the save query menu (#229053)](#229053) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Miłosz Radzyński","email":"mradzynski.elastic@gmail.com"},"sourceCommit":{"committedDate":"2025-07-30T07:16:45Z","message":"[Discover][Query Bar] Enable \"Save Query\" button after making changes in the save query menu (#229053)\n\n## Summary\n\nThis PR fixes an issue where the `Save Query` button was disabled after\nmaking changes (e.g., adding filters) in the query menu. Currently, a\nuser is unable to click `Save Query` if they previously saved the query\nwith the `Include filters` field unchecked and then added new filters.\n\nThe problem occurred because we compare the filter state in the\nuseEffect hook. However, if the user saved the query without the\n`Include filters` option, the in-memory object lacked the\n`attributes.filters` property entirely. This prevented the comparison\nfrom executing correctly and resulted in the logical test always\nreturning `false`.\n\nTo fix the issue, I removed the `savedQuery?.attributes.filters &&`\ncondition, and provided `[]` as a fallback value for\n`savedQuery?.attributes.filters` if the filters were not defined.\n\nResolves: #210948\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [x] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [x] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n- [ ] ...","sha":"43c1ea7e41bcd8a54af55c14a41287f6ca2911aa","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:DataDiscovery","backport:version","v8.19.0","v9.2.0","v9.0.5","v9.1.1","v8.18.5"],"title":"[Discover][Query Bar] Enable \"Save Query\" button after making changes in the save query menu","number":229053,"url":"https://github.com/elastic/kibana/pull/229053","mergeCommit":{"message":"[Discover][Query Bar] Enable \"Save Query\" button after making changes in the save query menu (#229053)\n\n## Summary\n\nThis PR fixes an issue where the `Save Query` button was disabled after\nmaking changes (e.g., adding filters) in the query menu. Currently, a\nuser is unable to click `Save Query` if they previously saved the query\nwith the `Include filters` field unchecked and then added new filters.\n\nThe problem occurred because we compare the filter state in the\nuseEffect hook. However, if the user saved the query without the\n`Include filters` option, the in-memory object lacked the\n`attributes.filters` property entirely. This prevented the comparison\nfrom executing correctly and resulted in the logical test always\nreturning `false`.\n\nTo fix the issue, I removed the `savedQuery?.attributes.filters &&`\ncondition, and provided `[]` as a fallback value for\n`savedQuery?.attributes.filters` if the filters were not defined.\n\nResolves: #210948\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [x] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [x] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n- [ ] ...","sha":"43c1ea7e41bcd8a54af55c14a41287f6ca2911aa"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.0","9.1","8.18"],"targetPullRequestStates":[{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/229053","number":229053,"mergeCommit":{"message":"[Discover][Query Bar] Enable \"Save Query\" button after making changes in the save query menu (#229053)\n\n## Summary\n\nThis PR fixes an issue where the `Save Query` button was disabled after\nmaking changes (e.g., adding filters) in the query menu. Currently, a\nuser is unable to click `Save Query` if they previously saved the query\nwith the `Include filters` field unchecked and then added new filters.\n\nThe problem occurred because we compare the filter state in the\nuseEffect hook. However, if the user saved the query without the\n`Include filters` option, the in-memory object lacked the\n`attributes.filters` property entirely. This prevented the comparison\nfrom executing correctly and resulted in the logical test always\nreturning `false`.\n\nTo fix the issue, I removed the `savedQuery?.attributes.filters &&`\ncondition, and provided `[]` as a fallback value for\n`savedQuery?.attributes.filters` if the filters were not defined.\n\nResolves: #210948\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [x] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [x] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n- [ ] ...","sha":"43c1ea7e41bcd8a54af55c14a41287f6ca2911aa"}},{"branch":"9.0","label":"v9.0.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.1","label":"v9.1.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Miłosz Radzyński <mradzynski.elastic@gmail.com>
…changes in the save query menu (#229053) (#229908) # Backport This will backport the following commits from `main` to `8.18`: - [[Discover][Query Bar] Enable "Save Query" button after making changes in the save query menu (#229053)](#229053) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Miłosz Radzyński","email":"mradzynski.elastic@gmail.com"},"sourceCommit":{"committedDate":"2025-07-30T07:16:45Z","message":"[Discover][Query Bar] Enable \"Save Query\" button after making changes in the save query menu (#229053)\n\n## Summary\n\nThis PR fixes an issue where the `Save Query` button was disabled after\nmaking changes (e.g., adding filters) in the query menu. Currently, a\nuser is unable to click `Save Query` if they previously saved the query\nwith the `Include filters` field unchecked and then added new filters.\n\nThe problem occurred because we compare the filter state in the\nuseEffect hook. However, if the user saved the query without the\n`Include filters` option, the in-memory object lacked the\n`attributes.filters` property entirely. This prevented the comparison\nfrom executing correctly and resulted in the logical test always\nreturning `false`.\n\nTo fix the issue, I removed the `savedQuery?.attributes.filters &&`\ncondition, and provided `[]` as a fallback value for\n`savedQuery?.attributes.filters` if the filters were not defined.\n\nResolves: #210948\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [x] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [x] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n- [ ] ...","sha":"43c1ea7e41bcd8a54af55c14a41287f6ca2911aa","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:DataDiscovery","backport:version","v8.19.0","v9.2.0","v9.0.5","v9.1.1","v8.18.5"],"title":"[Discover][Query Bar] Enable \"Save Query\" button after making changes in the save query menu","number":229053,"url":"https://github.com/elastic/kibana/pull/229053","mergeCommit":{"message":"[Discover][Query Bar] Enable \"Save Query\" button after making changes in the save query menu (#229053)\n\n## Summary\n\nThis PR fixes an issue where the `Save Query` button was disabled after\nmaking changes (e.g., adding filters) in the query menu. Currently, a\nuser is unable to click `Save Query` if they previously saved the query\nwith the `Include filters` field unchecked and then added new filters.\n\nThe problem occurred because we compare the filter state in the\nuseEffect hook. However, if the user saved the query without the\n`Include filters` option, the in-memory object lacked the\n`attributes.filters` property entirely. This prevented the comparison\nfrom executing correctly and resulted in the logical test always\nreturning `false`.\n\nTo fix the issue, I removed the `savedQuery?.attributes.filters &&`\ncondition, and provided `[]` as a fallback value for\n`savedQuery?.attributes.filters` if the filters were not defined.\n\nResolves: #210948\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [x] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [x] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n- [ ] ...","sha":"43c1ea7e41bcd8a54af55c14a41287f6ca2911aa"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.0","9.1","8.18"],"targetPullRequestStates":[{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/229053","number":229053,"mergeCommit":{"message":"[Discover][Query Bar] Enable \"Save Query\" button after making changes in the save query menu (#229053)\n\n## Summary\n\nThis PR fixes an issue where the `Save Query` button was disabled after\nmaking changes (e.g., adding filters) in the query menu. Currently, a\nuser is unable to click `Save Query` if they previously saved the query\nwith the `Include filters` field unchecked and then added new filters.\n\nThe problem occurred because we compare the filter state in the\nuseEffect hook. However, if the user saved the query without the\n`Include filters` option, the in-memory object lacked the\n`attributes.filters` property entirely. This prevented the comparison\nfrom executing correctly and resulted in the logical test always\nreturning `false`.\n\nTo fix the issue, I removed the `savedQuery?.attributes.filters &&`\ncondition, and provided `[]` as a fallback value for\n`savedQuery?.attributes.filters` if the filters were not defined.\n\nResolves: #210948\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [x] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [x] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n- [ ] ...","sha":"43c1ea7e41bcd8a54af55c14a41287f6ca2911aa"}},{"branch":"9.0","label":"v9.0.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.1","label":"v9.1.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Miłosz Radzyński <mradzynski.elastic@gmail.com>
… in the save query menu (elastic#229053) ## Summary This PR fixes an issue where the `Save Query` button was disabled after making changes (e.g., adding filters) in the query menu. Currently, a user is unable to click `Save Query` if they previously saved the query with the `Include filters` field unchecked and then added new filters. The problem occurred because we compare the filter state in the useEffect hook. However, if the user saved the query without the `Include filters` option, the in-memory object lacked the `attributes.filters` property entirely. This prevented the comparison from executing correctly and resulted in the logical test always returning `false`. To fix the issue, I removed the `savedQuery?.attributes.filters &&` condition, and provided `[]` as a fallback value for `savedQuery?.attributes.filters` if the filters were not defined. Resolves: elastic#210948 ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [x] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ...
Summary
This PR fixes an issue where the
Save Querybutton was disabled after making changes (e.g., adding filters) in the query menu. Currently, a user is unable to clickSave Queryif they previously saved the query with theInclude filtersfield unchecked and then added new filters.The problem occurred because we compare the filter state in the useEffect hook. However, if the user saved the query without the
Include filtersoption, the in-memory object lacked theattributes.filtersproperty entirely. This prevented the comparison from executing correctly and resulted in the logical test always returningfalse.To fix the issue, I removed the
savedQuery?.attributes.filters &&condition, and provided[]as a fallback value forsavedQuery?.attributes.filtersif the filters were not defined.Resolves: #210948
Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.
release_note:breakinglabel should be applied in these situations.release_note:*label is applied per the guidelinesbackport:*labels.Identify risks
Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss.
Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging.