logseq / logseq

A privacy-first, open-source platform for knowledge management and collaboration. Download link: http://github.com/logseq/logseq/releases. roadmap: http://trello.com/b/8txSM12G/roadmap
https://logseq.com
GNU Affero General Public License v3.0
30.07k stars 1.76k forks source link

Card category query does not trim trailing whitespace #11284

Open sudo-nano opened 2 weeks ago

sudo-nano commented 2 weeks ago

Search first

What Happened?

This appears to be a conflict between the following design features:

The result is that using autofill will have you search for "#my-tag " (note the trailing space) and typing the tag without autofill will have you search for "#my-tag" (no trailing space). If one has done both of these in their graph, the card category drop-down menu will index them separately, but they are visually indistinguishable.

Screenshot_20240430_124950

(Markdown for this screenshot is provided in the "Reproduce" section of the bug report.)

Reproduce the Bug

  1. Open a new page
  2. Paste in the following markdown:
    ## [[Card Category]]
    - Test Card 1 #card
        - asdf
    - Test Card 2 #card #test-category
        - qwerty
    -
    - Test Card 3 #card #test-category
    -
    - {{cards #test-category }}
    - {{cards #test-category}}
    - {{cards [[Card Category]] }}

Expected Behavior

There are two ways to solve this problem:

  1. Prevent autofill from inserting a trailing space
  2. Prevent the query from parsing the trailing space

In my opinion, the latter would be a better solution, because it would prevent user error from inadvertently causing this issue.

Screenshots

No response

Desktop or Mobile Platform Information

OS: EndeavourOS Linux x86_64 Kernel: 6.8.7-arch1-2 Logseq Version: 0.10.8

Additional Context

No response

Are you willing to submit a PR? If you know how to fix the bug.