# Badge query is cleared when changing badges

**URL:** https://meta.discourse.org/t/badge-query-is-cleared-when-changing-badges/62330
**Category:** Bug
**Created:** [May 9, 2017, 4:22am UTC](https://meta.discourse.org/t/badge-query-is-cleared-when-changing-badges/62330 "2017-05-09T04:22:05Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![barryvan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/barryvan/32/82635_2.png) [@barryvan](https://meta.discourse.org/u/barryvan)
#### Post date: [May 9, 2017, 4:22am UTC](https://meta.discourse.org/t/badge-query-is-cleared-when-changing-badges/62330/1 "2017-05-09T04:22:05Z")

</div>

This is a rather strange one, but I’ve managed to reproduce it quite consistently:

1. Ensure that you have badge SQL enabled.
2. Find a badge without a query (or create a new one), and enter a valid query.
3. Press Save.
4. Swap badges from the list on the left, and then change back.
5. Note how your query has disappeared, as well as query-related parameters like the trigger selection and revocation checkbox.
6. Reload the page – your query and selections return, and now stick.

It’s not a big problem, but it’s a little concerning at first when a query you’ve been working on apparently isn’t saved and disappears. 😉

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [May 9, 2017, 5:49am UTC](https://meta.discourse.org/t/badge-query-is-cleared-when-changing-badges/62330/2 "2017-05-09T05:49:03Z")

</div>

This is @sam’s code so I leave it up to him.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [May 9, 2017, 1:26pm UTC](https://meta.discourse.org/t/badge-query-is-cleared-when-changing-badges/62330/3 "2017-05-09T13:26:40Z")

</div>

Fixed per:

[https://github.com/discourse/discourse/commit/c2829dce22468e777bcf88ee9be96b72a6ff4321](https://github.com/discourse/discourse/commit/c2829dce22468e777bcf88ee9be96b72a6ff4321)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [May 9, 2017, 1:26pm UTC](https://meta.discourse.org/t/badge-query-is-cleared-when-changing-badges/62330/4 "2017-05-09T13:26:44Z")

</div>


