For over a year, I was bugged by a search quirk on Mintlify that caused race conditions and wonky search results. Here’s the fun irony: I was the founder of Trieve, the company that powered search for their 30,000+ documentation sites, yet their debounced search queries weren’t being aborted as you typed. I had brought this up in our shared Slack before when I was just a vendor toDocumentation Index
Fetch the complete documentation index at: https://mint.skeptrune.com/llms.txt
Use this file to discover all available pages before exploring further.
Fixed it
Now that I’m on the team, I was able to finally fix it. I added an AbortController to the debounced search function, so that it aborts any previous queries when a new one is made. This means that the search results are always relevant to what the user is currently typing.The
AbortController pattern is a lightweight way to cancel in-flight fetch requests. When a new keystroke fires before the previous request completes, the old request gets aborted and only the latest query’s results ever render.Open source
I prefer building and using open source software whenever possible, and this whole situation is a great example of why. With open source — when you encounter a bug or pain point, you can actually fix it yourself. Had this been an open source project during the year I was frustrated with the search race condition, I could have submitted a pull request with theAbortController fix and saved myself (and thousands of other users) the daily annoyance.
Instead, it remained a persistent irritation until I happened to join the company and gain access to the codebase. There’s something to be said for the immediate empowerment that comes with open source — though I understand why many companies choose different models for various business reasons.