# Can't erase the bookmark search input

**URL:** https://meta.discourse.org/t/cant-erase-the-bookmark-search-input/357861
**Category:** Bug
**Tags:** bookmarks
**Created:** [March 18, 2025, 11:21pm UTC](https://meta.discourse.org/t/cant-erase-the-bookmark-search-input/357861 "2025-03-18T23:21:01Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [March 18, 2025, 11:21pm UTC](https://meta.discourse.org/t/cant-erase-the-bookmark-search-input/357861/1 "2025-03-18T23:21:01Z")

</div>

When we fill in the bookmark search input and send the request, then we can’t delete the input’s content.

Steps:

1. Fill in the bookmark search input

2. Run the search

3. Try deleting the input’s content by pressing backspace

4. When reaching the first letter, the input’s content resets to the current query’s value

Video:

---

<div class="post-metadata">

### Author: ![ondrej](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ondrej/32/198804_2.png) [@ondrej](https://meta.discourse.org/u/ondrej)
#### Post date: [March 18, 2025, 11:23pm UTC](https://meta.discourse.org/t/cant-erase-the-bookmark-search-input/357861/2 "2025-03-18T23:23:47Z")

</div>

I can repro this too. Nice catch! 🎣

---

<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: [March 19, 2025, 12:42am UTC](https://meta.discourse.org/t/cant-erase-the-bookmark-search-input/357861/3 "2025-03-19T00:42:06Z")

</div>

Wow that sure is odd, added a priority tag on this, someone will have a look over the next 4 weeks, but if anyone feels like a submitting a PR in the meantime you are welcome to.

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [March 19, 2025, 4:44am UTC](https://meta.discourse.org/t/cant-erase-the-bookmark-search-input/357861/4 "2025-03-19T04:44:43Z")

</div>

I took a look; the issue is here:

[https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/controllers/user-activity-bookmarks.js#L33](https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/controllers/user-activity-bookmarks.js#L33)

Here is what happens.

When you remove the last character, `get` is called. At this point, `_searchTerm` is empty.  
However, `this._searchTerm || this.q` will treat the empty string as falsy, and the value of `q` is displayed instead.

A quick fix could be to check this way:

```js
return this._searchTerm !== undefined ? this._searchTerm : this.q;

```

Note: the initial value of `_searchTerm` is `undefined`.  
Note: because of `computed("q")`, the issue doesn’t happen when you select/delete (probably because the timing is too tight to invalidate the cache?)

* * *

> **I wanted to PR, but..**
>
> the core tests (without modification) fail for some reason.  
> I’m using `bin/rspec spec/system/user_activity_bookmarks_spec.rb`.  
> The log says that either the search is not present or bookmarks are not created.  
> Do I miss something?
> 
> > **Logs**
> >
> > (base) arkshine@HOME:~/discourse$ bin/rspec spec/system/user\_activity\_bookmarks\_spec.rb
> > 
> > Randomized with seed 38172  
> > unknown OID 931304: failed to recognize type of ‘embeddings’. It will be treated as String.  
> > FFF
> > 
> > Failures:
> > 
> > 1. User activity bookmarks can clear the query  
> > Failure/Error: super
> > 
> > 2. User activity bookmarks can filter the list of bookmarks  
> > Failure/Error: super
> > 
> > 3. User activity bookmarks can filter the list of bookmarks from the URL  
> > Failure/Error: expect(user\_activity\_bookmarks).to have\_topic(bookmark\_1.bookmarkable.topic)  
> > expected `#<PageObjects::Pages::UserActivityBookmarks:0x00007f51dcb37b00>.has_topic?(#<Topic id: 699, title: "This is a test topic 0", last_posted_at: nil, created_at: "2025-03-19 04:35:...oad_id: nil, slow_mode_seconds: 0, bannered_until: nil, external_id: nil, visibility_reason_id: nil>)` to be truthy, got false
> > 
> > Finished in 21.7 seconds (files took 3.8 seconds to load)  
> > 3 examples, 3 failures
> > 
> > Failed examples:
> > 
> > rspec ./spec/system/user\_activity\_bookmarks\_spec.rb:50 # User activity bookmarks can clear the query  
> > rspec ./spec/system/user\_activity\_bookmarks\_spec.rb:43 # User activity bookmarks can filter the list of bookmarks  
> > rspec ./spec/system/user\_activity\_bookmarks\_spec.rb:36 # User activity bookmarks can filter the list of bookmarks from the URL

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [March 19, 2025, 5:17am UTC](https://meta.discourse.org/t/cant-erase-the-bookmark-search-input/357861/5 "2025-03-19T05:17:43Z")

</div>

> [@Arkshine](#):
>
> the core tests (without modification) fail for some reason.  
> I’m using `bin/rspec spec/system/user_activity_bookmarks_spec.rb`.

You will need to run `bin/ember-cli` in the background or run `bin/ember-cli --build` before your changes in JS land is available to the system test process.

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [March 19, 2025, 3:01pm UTC](https://meta.discourse.org/t/cant-erase-the-bookmark-search-input/357861/6 "2025-03-19T15:01:59Z")

</div>

(_this should probably be moved to a dev topic_).

Alan, I have `bin/ember-cli` running (I also tried `bin/ember-cli --build`).

Am I doing something wrong? 🤔

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [March 20, 2025, 1:34am UTC](https://meta.discourse.org/t/cant-erase-the-bookmark-search-input/357861/7 "2025-03-20T01:34:11Z")

</div>

Can you please push your changes to a branch on github? I can help you have a look to see what might be wrong.

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [March 20, 2025, 4:50am UTC](https://meta.discourse.org/t/cant-erase-the-bookmark-search-input/357861/8 "2025-03-20T04:50:05Z")

</div>

I made the PR:

[https://github.com/discourse/discourse/pull/31919](https://github.com/discourse/discourse/pull/31919)

> [@tgxworld](#):
>
> Can you please push your changes to a branch on github? I can help you have a look to see what might be wrong.

My issue is that these default tests fail, even without local changes.  
Specifically, for fabricated bookmarks, they seem not to be available. It sounds like something is not loaded/written correctly.

In the PR, I added a small test that doesn’t rely on a fabricated bookmark, so it works on my local.

---

<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: [March 21, 2025, 4:28am UTC](https://meta.discourse.org/t/cant-erase-the-bookmark-search-input/357861/9 "2025-03-21T04:28:55Z")

</div>

5 posts were split to a new topic: [Having issues running tests on my WSL2 system](https://meta.discourse.org/t/having-issues-running-tests-on-my-wsl2-system/358275)

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [March 22, 2025, 7:39pm UTC](https://meta.discourse.org/t/cant-erase-the-bookmark-search-input/357861/10 "2025-03-22T19:39:07Z")

</div>

The fix has been merged and the bug is fixed, thank you! 🚀

---

<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: [March 23, 2025, 10:42pm UTC](https://meta.discourse.org/t/cant-erase-the-bookmark-search-input/357861/11 "2025-03-23T22:42:16Z")

</div>


