chhoumann / quickadd

QuickAdd for Obsidian
https://quickadd.obsidian.guide
MIT License
1.48k stars 135 forks source link

[BUG] Suggester broken with large number of results #586

Open jloh opened 10 months ago

jloh commented 10 months ago

Describe the bug When using the QuickAdd API and using a Suggester prompt search fails to filter the options.

When putting a field into the search box the list doesn't filter out irrelevant results.

To Reproduce Steps to reproduce the behavior:

  1. Create a suggester using the params.quickAddApi.suggester API that results in a large number of results (99+)
  2. Put a query in the search box
  3. See results don't filter
  4. Open the developer console and see a error about toLowerCase

Expected behavior Search results filter

Screenshots N/A

Desktop (please complete the following information):

Obsidian Debug output ``` SYSTEM INFO: Obsidian version: v1.4.16 Installer version: v1.4.13 Operating system: Darwin Kernel Version 22.6.0: Fri Sep 15 13:41:28 PDT 2023; root:xnu-8796.141.3.700.8~1/RELEASE_ARM64_T6000 22.6.0 Login status: logged in Catalyst license: insider Insider build toggle: on Live preview: on Legacy editor: off Base theme: dark Community theme: Minimal v7.3.2 Snippets enabled: 6 Restricted mode: off Plugins installed: 31 Plugins enabled: 14 1: Dataview v0.5.61 2: QuickAdd v1.4.0 3: Default New Tab Page v0.11.2 4: Templater v1.16.4 5: Calendar v1.5.10 6: Force note view mode v1.2.0 7: Periodic Notes v0.0.17 8: Folder notes v1.6.2 9: Book Search v0.5.10 10: MetaEdit v1.8.2 11: Readwise Official v2.0.1 12: Minimal Theme Settings v7.3.0 13: Style Settings v1.0.7 14: Obsidian42 - BRAT v0.7.0 RECOMMENDATIONS: Custom theme and snippets: for cosmetic issues, please first try updating your theme and disabling your snippets. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community theme and snippets. Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins. ```

Additional context

The specific error thrown is:

app.js:1 Uncaught TypeError: n.toLowerCase is not a function
    at QA (app.js:1:1172003)
    at JA (app.js:1:1172567)
    at t.getSuggestions (app.js:1:1939760)
    at t.updateSuggestions (app.js:1:1938962)
    at t.onInput (app.js:1:1938861)
QA @ app.js:1
JA @ app.js:1
t.getSuggestions @ app.js:1
t.updateSuggestions @ app.js:1
t.onInput @ app.js:1

I'm able to experience this using the movie tutorial script, but I imagine it'd be applicable with most.

jloh commented 10 months ago

Okay turns out this is only a problem when the suggester is given a large number of results, eg greater than 100. It bugs out the suggester and only shows the first 100 or so results and breaks search. So there are two bugs potentially?