From 3165d4c1ac692b2fb1a8ba2c1a6cd7ac8e1868a2 Mon Sep 17 00:00:00 2001 From: FlaminSarge Date: Thu, 19 Dec 2024 06:33:26 -0800 Subject: [PATCH] Tweak to avoid deleting previous session, instead updating initialItemId --- src/app/compare/reducer.ts | 2 +- src/app/item-actions/ActionButtons.tsx | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/compare/reducer.ts b/src/app/compare/reducer.ts index 8f93fb64f..ffc443d99 100644 --- a/src/app/compare/reducer.ts +++ b/src/app/compare/reducer.ts @@ -25,7 +25,7 @@ export interface CompareSession { /** * The instance ID of the first item added to compare, so we can highlight it. */ - readonly initialItemId?: string; + initialItemId?: string; /** * The ID of the character (if any) whose vendor response we should intermingle with owned items diff --git a/src/app/item-actions/ActionButtons.tsx b/src/app/item-actions/ActionButtons.tsx index c141c44b0..410366b19 100644 --- a/src/app/item-actions/ActionButtons.tsx +++ b/src/app/item-actions/ActionButtons.tsx @@ -1,4 +1,5 @@ -import { addCompareItem, endCompareSession } from 'app/compare/actions'; +import { addCompareItem } from 'app/compare/actions'; +import { compareSessionSelector } from 'app/compare/selectors'; import { settingSelector } from 'app/dim-api/selectors'; import { t } from 'app/i18next-t'; import { showInfuse } from 'app/infuse/infuse'; @@ -30,11 +31,12 @@ interface ActionButtonProps { export function CompareActionButton({ item, label, fromCompare = false }: ActionButtonProps) { const dispatch = useDispatch(); + const session = useSelector(compareSessionSelector); const openCompare = () => { hideItemPopup(); if (fromCompare) { - dispatch(endCompareSession()); + session.initialItemId = item.id; } dispatch(addCompareItem(item)); };