stash icon indicating copy to clipboard operation
stash copied to clipboard

[Bug Report] Trailing space gets eaten in scene search box

Open troger385 opened this issue 1 year ago • 1 comments

Describe the bug If you write something in the scene search box that ends with a space (because you intend to write something after), the space gets removed as the scene view refreshes.

To Reproduce Steps to reproduce the behavior:

  1. Go to the scenes view
  2. Write a word followed by a space in the search box
  3. Wait for the view to refresh
  4. Notice that the space has been removed

Expected behavior I would expect the space to remain.

Stash Version: (from Settings -> About): v0.27.2

Desktop (please complete the following information):

  • OS: Linux
  • Browser: Firefox
  • Version: 131.0.3

troger385 avatar Oct 18 '24 15:10 troger385

By refresh, do you mean full page refresh?

Changing view mode or any other changes made to the filter/search doesn't remove the trailing spaces for me. That only happens with full page refresh.

DogmaDragon avatar Oct 18 '24 16:10 DogmaDragon

By refresh, do you mean full page refresh?

Changing view mode or any other changes made to the filter/search doesn't remove the trailing spaces for me. That only happens with full page refresh.

@DogmaDragon, No, as in the search starts to filter the currently displayed results based on what you have now typed. To reproduce, it's a tad tricky it seems, as timing is important - you have to have typed a space just before the search function refreshes the results view to see this happen.

But it is definitely happening frequently and very annoying.

Using Chrome Version 130.0.6723.117 and seeing it as well.

https://github.com/user-attachments/assets/f5d58223-e253-4e59-945a-124c09cdd938

Lamda604 avatar Nov 10 '24 01:11 Lamda604

Sorry @DogmaDragon, I did not see your reply 3 weeks ago.

The description by @Lamda604 is good. An easy way to reproduce (to ensure proper timing) is to paste a search term that ends with a space. Once the view refreshes, the space will be gone.

troger385 avatar Nov 10 '24 02:11 troger385

Ok, I debugged the JS a bit, I think I found the culprit:

diff --git a/ui/v2.5/src/models/list-filter/filter.ts b/ui/v2.5/src/models/list-filter/filter.ts
index 183b630a25ea..bc33a592ea2a 100644
--- a/ui/v2.5/src/models/list-filter/filter.ts
+++ b/ui/v2.5/src/models/list-filter/filter.ts
@@ -191,7 +191,7 @@ export class ListFilterModel {
       ret.disp = Number.parseInt(params.disp, 10);
     }
     if (params.q) {
-      ret.q = params.q.trim();
+      ret.q = params.q;
     }
     if (params.p) {
       ret.p = Number.parseInt(params.p, 10);

When the search term in the filter changes, it triggers an URL update, which triggers an "update filter from URL" operation, which includes that trim. Removing it seems to to the job.

troger385 avatar Nov 10 '24 03:11 troger385