Skip to content

fix: exclude dead/offline sites from single-site search submenu#1219

Closed
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-dead-site-appears-in-search
Closed

fix: exclude dead/offline sites from single-site search submenu#1219
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-dead-site-appears-in-search

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 5, 2026

With "Allow single site search" enabled, sites marked isDead: true in their definition still appeared in the single-site search submenu. The bug exists because getSortedAddedSites only surfaces ISiteUserConfigisDead lives in ISiteMetadata (definition files) and is never cached in user config. A site added while alive retains allowSearch: true in stored config even after its definition gains isDead: true.

Changes

  • Topbar.vue: Replace the synchronous getSortedAddedSites + v-if="allowSearch" pattern with a computedAsync (singleSiteSearchItems) that:
    • Pre-filters synchronously on allowSearch and isOffline (available in user config)
    • Loads site definitions in parallel via Promise.all and drops any site where siteMetadata.isDead === true
const singleSiteSearchItems = computedAsync(async () => {
  const sites = metadataStore.getSortedAddedSites.filter((site) => (site.allowSearch ?? false) && !site.isOffline);
  const results = await Promise.all(
    sites.map(async (site) => {
      const siteMetadata = await metadataStore.getSiteMetadata(site.id);
      return siteMetadata.isDead ? null : site;
    }),
  );
  return results.filter((site) => site !== null);
}, []);

This mirrors the existing logic in getSiteDefaultSearchSolution which already gates on both isOffline and isDead when building actual search execution plans.

Copilot AI requested review from Copilot and removed request for Copilot May 5, 2026 01:39
Copilot AI linked an issue May 5, 2026 that may be closed by this pull request
Copilot AI requested review from Copilot and removed request for Copilot May 5, 2026 01:46
Copilot AI changed the title [WIP] Fix dead site appearing in single site search fix: exclude dead/offline sites from single-site search submenu May 5, 2026
Copilot finished work on behalf of Rhilip May 5, 2026 01:47
Copilot AI requested a review from Rhilip May 5, 2026 01:47
@Rhilip Rhilip closed this May 15, 2026
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