Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mint.skeptrune.com/llms.txt

Use this file to discover all available pages before exploring further.

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 to them us (weird), but it wasn’t a priority and never got fixed. It was extra frustrating because the race condition on the query was apparent enough that search would sometimes feel low quality — returning results for a query many characters before the user was done typing. Even worse, as the founder of the search company powering this experience, it felt like a poor reflection on Trieve every time someone encountered these wonky results.

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.
// Before: debounced search with no abort
const debouncedSearch = debounce((query) => {
  fetch(`/api/search?q=${query}`)
    .then(res => res.json())
    .then(setResults);
}, 300);

// After: debounced search with AbortController
let controller;
const debouncedSearch = debounce((query) => {
  if (controller) controller.abort();
  controller = new AbortController();
  fetch(`/api/search?q=${query}`, { signal: controller.signal })
    .then(res => res.json())
    .then(setResults)
    .catch(err => {
      if (err.name !== "AbortError") throw err;
    });
}, 300);
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.
There’s something deeply satisfying about finally being able to fix the things that bug you. It made me feel a bit like George Hotz during his single week at Twitter in 2022, where he joined with overambitious plans to fix Twitter search, gave up due to hubris, and settled for fixing an annoying login popup before leaving. I’ve always admired engineers who are part hacker, part entrepreneur — people who see a problem and just… fix it. Getting to do something similar here (minus the dramatic exit) felt like a small win in steering my career toward that kind of direct approach.

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 the AbortController 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.
If you find a bug in an open source project you rely on, try fixing it yourself before filing an issue. A focused pull request is often faster to merge than a bug report is to triage.

Self-congratulation

If search feels just a bit crisper and more responsive on Mintlify, it’s because of me. I fixed a bug that bothered me for over a year, and it feels great to have made that little improvement to the product. I can’t wait to make more. Fixing small issues like this over and over again is how products become legendary. There’s something deeply satisfying about finally having the power to fix the things that annoy you — even if they’re tiny. Especially if they’re tiny.