Skip to content

[Discover][Query Bar] Enable "Save Query" button after making changes in the save query menu#229053

Merged
MiloszRadzynski merged 5 commits intoelastic:mainfrom
MiloszRadzynski:save-query-disabled-button-fix
Jul 30, 2025
Merged

[Discover][Query Bar] Enable "Save Query" button after making changes in the save query menu#229053
MiloszRadzynski merged 5 commits intoelastic:mainfrom
MiloszRadzynski:save-query-disabled-button-fix

Conversation

@MiloszRadzynski
Copy link
Contributor

@MiloszRadzynski MiloszRadzynski commented Jul 23, 2025

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: #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, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests 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
  • 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.
  • Flaky Test Runner 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
  • Review the backport guidelines 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.

@MiloszRadzynski MiloszRadzynski requested a review from a team July 23, 2025 07:50
@MiloszRadzynski MiloszRadzynski self-assigned this Jul 23, 2025
@MiloszRadzynski MiloszRadzynski added the Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// label Jul 23, 2025
@MiloszRadzynski
Copy link
Contributor Author

/ci

@kibanamachine
Copy link
Contributor

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.

see run history

@MiloszRadzynski MiloszRadzynski force-pushed the save-query-disabled-button-fix branch from 99d134c to bea19a4 Compare July 25, 2025 08:39
@kibanamachine
Copy link
Contributor

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.

see run history

@MiloszRadzynski
Copy link
Contributor Author

/ci

2 similar comments
@MiloszRadzynski
Copy link
Contributor Author

/ci

@MiloszRadzynski
Copy link
Contributor Author

/ci

@MiloszRadzynski MiloszRadzynski marked this pull request as ready for review July 28, 2025 10:58
@MiloszRadzynski MiloszRadzynski requested a review from a team as a code owner July 28, 2025 10:58
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

@MiloszRadzynski MiloszRadzynski requested review from a team and davismcphee July 28, 2025 10:59
Copy link
Contributor

@ThomThomson ThomThomson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@MiloszRadzynski MiloszRadzynski force-pushed the save-query-disabled-button-fix branch from 4bb4ec1 to f63c50c Compare July 29, 2025 10:58
@MiloszRadzynski
Copy link
Contributor Author

@ThomThomson Thank you for your review! I addressed your suggestion in f63c50c. Please let me know if it's okay now

@MiloszRadzynski
Copy link
Contributor Author

/ci

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
unifiedSearch 339.9KB 339.9KB -14.0B

History

cc @MiloszRadzynski

Copy link
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

@ThomThomson ThomThomson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes LGTM! Thanks for fixing this!

const filtersHaveChanged = Boolean(
savedQuery?.attributes.filters &&
!compareFilters(filters ?? [], savedQuery.attributes.filters, COMPARE_ALL_OPTIONS)
const filtersHaveChanged = !compareFilters(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks much better, thank you for making the change!

@MiloszRadzynski MiloszRadzynski merged commit 43c1ea7 into elastic:main Jul 30, 2025
12 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.18, 8.19, 9.0, 9.1

https://github.com/elastic/kibana/actions/runs/16616025719

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 30, 2025
… 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)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 30, 2025
… 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)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 30, 2025
… 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)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 30, 2025
… 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)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.18
8.19
9.0
9.1

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 Jul 30, 2025
…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>
kibanamachine added a commit that referenced this pull request Jul 30, 2025
…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>
kibanamachine added a commit that referenced this pull request Jul 30, 2025
…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>
kibanamachine added a commit that referenced this pull request Jul 30, 2025
…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>
delanni pushed a commit to delanni/kibana that referenced this pull request Aug 5, 2025
… 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)
- [ ] ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels release_note:fix Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// v8.18.5 v8.19.0 v9.0.5 v9.1.1 v9.2.0

5 participants