확인해 봤는데, 문제는 여기 있습니다:
여기서 일어나는 일은 다음과 같습니다.
마지막 문자를 삭제하면 get이 호출됩니다. 이 시점에서 _searchTerm은 비어 있습니다.
그러나 this._searchTerm || this.q는 빈 문자열을 falsy로 취급하므로, 대신 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:
-
User activity bookmarks can clear the query
Failure/Error: superCapybara::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>' -
User activity bookmarks can filter the list of bookmarks
Failure/Error: superCapybara::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>' -
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