refactor(store): migrate call sites that landed after this branch

github.ts and ai-vault-session-identity.ts began using areValuesEqual on main
while this branch was stale, and repo-identity-reconcile's record reconciler
still called its own deleted walker. All three now use structuralValuesEqual;
reuseEqualCatalogRows keeps its duplicate-id cap and calls the ignoring-undefined
variant, which is the key-union semantics catalogValuesEqual had.
This commit is contained in:
Neil
2026-08-13 22:05:04 -07:00
parent f9cd3840ef
commit 9526668764
3 changed files with 9 additions and 6 deletions
@@ -1,5 +1,5 @@
import type { AiVaultListResult, AiVaultSession } from '../../../../shared/ai-vault-types'
import { areValuesEqual } from '@/store/slices/repo-identity-reconcile'
import { structuralValuesEqual } from '../../../../shared/structural-value-equality'
import { reuseEqualCatalogRows } from '@/store/slices/worktree-catalog-reconciliation'
// One instance is shared by every mounted hook, so it is frozen: an in-place
@@ -24,7 +24,9 @@ export function reuseAiVaultListResult(
return incoming
}
const sessions = reuseEqualCatalogRows(current.sessions, incoming.sessions)
const issues = areValuesEqual(current.issues, incoming.issues) ? current.issues : incoming.issues
const issues = structuralValuesEqual(current.issues, incoming.issues)
? current.issues
: incoming.issues
if (
sessions === current.sessions &&
issues === current.issues &&
+4 -3
View File
@@ -78,7 +78,8 @@ import { normalizeGitHubPRForBranchOutcome } from '../../../../shared/github/pul
import { restoreReactionOnSubject, setReactionOnSubject } from '@/lib/pr-comment-reactions'
import { withGitHubCheckDetailsTimeout } from '@/runtime/github-check-details-timeout'
import { getGitHubRepoLookupIndex } from './github-repo-lookup-index'
import { areValuesEqual, reconcileCatalogRows } from './repo-identity-reconcile'
import { reconcileCatalogRows } from './repo-identity-reconcile'
import { structuralValuesEqual } from '../../../../shared/structural-value-equality'
// ─── ProjectV2 cache types ────────────────────────────────────────────
// Why: separate from CacheEntry<T> — project-view has a single GraphQL source (no issue/PR fallback) and a distinct error union.
@@ -2759,8 +2760,8 @@ export const createGitHubSlice: StateCreator<AppState, [], [], GitHubSlice> = (s
(row) => `${row.repoId}\0${row.id}`
)
const nextFellBack = envelope.issueSourceFellBack ? true : undefined
const sourcesUnchanged = areValuesEqual(previousEntry?.sources, envelope.sources)
const errorUnchanged = areValuesEqual(previousEntry?.error, errorForCache)
const sourcesUnchanged = structuralValuesEqual(previousEntry?.sources, envelope.sources)
const errorUnchanged = structuralValuesEqual(previousEntry?.error, errorForCache)
const fellBackUnchanged = previousEntry?.issueSourceFellBack === nextFellBack
if (
previousEntry &&
@@ -61,7 +61,7 @@ export function reuseEqualRecordMap<T>(
const reconciled: Record<string, T> = {}
for (const key of nextKeys) {
const existing = Object.hasOwn(previous, key) ? previous[key] : undefined
if (existing !== undefined && areValuesEqual(existing, next[key])) {
if (existing !== undefined && structuralValuesEqual(existing, next[key])) {
reconciled[key] = existing
continue
}