ブックマーク検索入力欄を消せません

確認しました。問題はここにあります。

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

以下のような動作になります。

最後の文字を削除すると、get が呼び出されます。この時点で _searchTerm は空です。
しかし、this._searchTerm || this.q は空文字列を偽とみなし、q の値が表示されてしまいます。

簡単な修正としては、このようにチェックすることが考えられます。

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

注: _searchTerm の初期値は undefined です。
注: computed("q") のため、タイミングがタイトすぎてキャッシュが無効にならない(?)せいか、選択/削除時には問題が発生しません。


PRを作成したかったのですが…

コアテスト(変更なし)が何らかの理由で失敗します。
bin/rspec spec/system/user_activity_bookmarks_spec.rb を使用しています。
ログによると、検索が存在しないか、ブックマークが作成されていないとのことです。
何か見落としていることはありますか?

ログ

(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

    Capybara::ElementNotFound:
    Unable to find field “bookmark-search” that is not disabled

    ~~~~~ END JS LOGS ~~~~
    
    # ./spec/system/page_objects/pages/user_activity_bookmarks.rb:24:in `fill_in_search'
    # ./spec/system/page_objects/pages/user_activity_bookmarks.rb:14:in `search_for'
    # ./spec/system/user_activity_bookmarks_spec.rb:51:in `block (2 levels) in <main>'
    
    
  2. User activity bookmarks can filter the list of bookmarks
    Failure/Error: super

    Capybara::ElementNotFound:
    Unable to find field “bookmark-search” that is not disabled

    ~~~~~ END JS LOGS ~~~~
    
    # ./spec/system/page_objects/pages/user_activity_bookmarks.rb:24:in `fill_in_search'
    # ./spec/system/page_objects/pages/user_activity_bookmarks.rb:14:in `search_for'
    # ./spec/system/user_activity_bookmarks_spec.rb:44:in `block (2 levels) in <main>'
    
    
  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

    ~~~~~ END JS LOGS ~~~~
    
    # ./spec/system/user_activity_bookmarks_spec.rb:40:in `block (2 levels) in <main>'
    
    

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

「いいね!」 4