# 无法清除书签搜索输入框

**URL:** https://meta.discourse.org/t/cant-erase-the-bookmark-search-input/357861
**Category:** Bug
**Tags:** bookmarks
**Created:** [2025年三月18日 23:21 UTC](https://meta.discourse.org/t/cant-erase-the-bookmark-search-input/357861 "2025-03-18T23:21:01Z")
**Posts on this page:** 1
**Showing post:** 8

<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: [2025年三月20日 04:50 UTC](https://meta.discourse.org/t/cant-erase-the-bookmark-search-input/357861/8 "2025-03-20T04:50:05Z")

</div>

我已提交 PR：

> <https://github.com/discourse/discourse/pull/31919>
>
> Meta: https://meta.discourse.org/t/cant-erase-the-bookmark-search-input/357861/4…
> 
> \> When we fill in the bookmark search input and send the request, then we can’t delete the input’s content.
> 
> After removing the last character, the \`searchTerm\` getter is called. At this point, \`\_searchTerm\` is empty.
> However, \`this.\_searchTerm || this.q\` will treat the empty string as \_falsy\_, and the \`q\` value is displayed instead.
> It makes it impossible to clear the input.
> 
> To fix this, we check specifically on the initial state of \`\_searchTerm,\` which is \_undefined\_, to include an empty string as a valid value.
> 
> Note: because of \`@computed\`, the issue is not triggered when the content is selected and deleted.

> [@tgxworld](#):
>
> 您能否将您的更改推送到 GitHub 上的一个分支？我可以帮助您查看可能出了什么问题。

我的问题是，即使没有本地更改，这些默认测试也会失败。  
具体来说，对于伪造的书签，它们似乎不可用。听起来有些东西没有正确加载/写入。

在 PR 中，我添加了一个不依赖于伪造书签的小测试，所以它可以在本地运行。

---

_[View the full topic](https://meta.discourse.org/t/cant-erase-the-bookmark-search-input/357861)._
