From a0e2cd550380e3e81347e85f973e303bbaddb820 Mon Sep 17 00:00:00 2001 From: Markus Olsson Date: Tue, 17 Dec 2024 13:04:14 +0100 Subject: [PATCH] Skip caching for now, worry about cache invalidation later --- .../merge-choose-branch-dialog.tsx | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/app/src/ui/multi-commit-operation/choose-branch/merge-choose-branch-dialog.tsx b/app/src/ui/multi-commit-operation/choose-branch/merge-choose-branch-dialog.tsx index 2de231e524c..361aa16384e 100644 --- a/app/src/ui/multi-commit-operation/choose-branch/merge-choose-branch-dialog.tsx +++ b/app/src/ui/multi-commit-operation/choose-branch/merge-choose-branch-dialog.tsx @@ -1,7 +1,7 @@ import React from 'react' import { getAheadBehind, revSymmetricDifference } from '../../../lib/git' import { determineMergeability } from '../../../lib/git/merge-tree' -import { Branch, IAheadBehind } from '../../../models/branch' +import { Branch } from '../../../models/branch' import { ComputedAction } from '../../../models/computed-action' import { MergeTreeResult } from '../../../models/merge' import { MultiCommitOperationKind } from '../../../models/multi-commit-operation' @@ -13,19 +13,6 @@ import { canStartOperation, } from './base-choose-branch-dialog' import { truncateWithEllipsis } from '../../../lib/truncate-with-ellipsis' -import QuickLRU from 'quick-lru' -import pMemoize from 'p-memoize' - -const mergeTreeCache = pMemoize(determineMergeability, { - cache: new QuickLRU({ maxSize: 250 }), - cacheKey: ([_, ours, theirs]: Parameters) => - `${ours.tip.sha} <- ${theirs.tip.sha}`, -}) - -const aheadBehindCache = pMemoize(getAheadBehind, { - cache: new QuickLRU({ maxSize: 250 }), - cacheKey: ([_, range]: Parameters) => range, -}) interface IMergeChooseBranchDialogState { readonly commitCount: number @@ -114,7 +101,7 @@ export class MergeChooseBranchDialog extends React.Component< private updateStatus = async (branch: Branch) => { const { currentBranch, repository } = this.props - const mergeStatus = await mergeTreeCache( + const mergeStatus = await determineMergeability( repository, currentBranch, branch @@ -142,7 +129,7 @@ export class MergeChooseBranchDialog extends React.Component< // Commit count is used in the UI output as well as determining whether the // submit button is enabled const range = revSymmetricDifference('', branch.name) - const aheadBehind = await aheadBehindCache(repository, range) + const aheadBehind = await getAheadBehind(repository, range) const commitCount = aheadBehind ? aheadBehind.behind : 0 if (this.state.selectedBranch.tip.sha !== branch.tip.sha) {