Skip to content

Commit d44e9ac

Browse files
committed
Tweak to avoid deleting previous session, instead updating initialItemId
1 parent 7852d55 commit d44e9ac

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/app/compare/reducer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export interface CompareSession {
2525
/**
2626
* The instance ID of the first item added to compare, so we can highlight it.
2727
*/
28-
readonly initialItemId?: string;
28+
initialItemId?: string;
2929

3030
/**
3131
* The ID of the character (if any) whose vendor response we should intermingle with owned items

src/app/item-actions/ActionButtons.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { addCompareItem, endCompareSession } from 'app/compare/actions';
1+
import { addCompareItem } from 'app/compare/actions';
2+
import { compareSessionSelector } from 'app/compare/selectors';
23
import { settingSelector } from 'app/dim-api/selectors';
34
import { t } from 'app/i18next-t';
45
import { showInfuse } from 'app/infuse/infuse';
@@ -30,11 +31,12 @@ interface ActionButtonProps {
3031

3132
export function CompareActionButton({ item, label, fromCompare = false }: ActionButtonProps) {
3233
const dispatch = useDispatch();
34+
const session = useSelector(compareSessionSelector);
3335

3436
const openCompare = () => {
3537
hideItemPopup();
36-
if (fromCompare) {
37-
dispatch(endCompareSession());
38+
if (fromCompare && session) {
39+
session.initialItemId = item.id;
3840
}
3941
dispatch(addCompareItem(item));
4042
};

0 commit comments

Comments
 (0)