Skip to content

fix(browser-search): restore frecency function removed in #434#449

Merged
shobhit99 merged 1 commit into
SuperCmdLabs:mainfrom
monotykamary:fix/browser-search-frecency
May 26, 2026
Merged

fix(browser-search): restore frecency function removed in #434#449
shobhit99 merged 1 commit into
SuperCmdLabs:mainfrom
monotykamary:fix/browser-search-frecency

Conversation

@monotykamary
Copy link
Copy Markdown
Contributor

Problem

Commit 8992618 (PR #434 — "combine browser and root search improvements") deleted the frecency() helper function but kept two call sites in the new getLegacyCompletion() function, causing a ReferenceError: frecency is not defined at runtime when the legacy completion path is hit (i.e. when alphaChromiumRootSearchEnabled is off).

Fix

Restore the accidentally deleted frecency(entry: BrowserSearchEntry) function:

function frecency(entry: BrowserSearchEntry): number {
  const ageDays = Math.max(0, (Date.now() - entry.lastUsedAt) / (24 * 60 * 60 * 1000));
  const recencyFactor = 1 / (1 + Math.log10(1 + ageDays));
  return entry.useCount * recencyFactor;
}

This is the exact implementation that was removed — no logic changes.

Testing

  • TypeScript compiles without errors
  • The legacy browser search autocomplete path no longer throws ReferenceError

The commit 8992618 (feat: combine browser and root search improvements SuperCmdLabs#434)
accidentally deleted the frecency() helper but kept call sites in
getLegacyCompletion(), causing a ReferenceError at runtime.
@shobhit99 shobhit99 merged commit 1d81d5c into SuperCmdLabs:main May 26, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants