Skip to content

Commit

Permalink
Tweak to avoid deleting previous session, instead updating initialItemId
Browse files Browse the repository at this point in the history
  • Loading branch information
FlaminSarge committed Dec 19, 2024
1 parent 606fc9d commit 6efa696
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/app/compare/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions src/app/item-actions/ActionButtons.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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());
if (fromCompare && session) {
session.initialItemId = item.id;
}
dispatch(addCompareItem(item));
};
Expand Down

0 comments on commit 6efa696

Please sign in to comment.