Fix bug unwearing/removing search results
Oops, our "items to reconsider" feature was preventing unwearing/removing items you're already wearing!
This feature helps you try stuff in Search, without disrupting your outfit. e.g. if you try on a new Background, then change your mind and unwear it, then we reapply whatever old Background you had on the outfit before.
But this made it impossible to remove your _current_ background from the search page if you went back and searched for it again, because we would remove it and then reconsider and reapply it 😅
Now we, um, stop that!
This commit is contained in:
parent
6517087568
commit
f3173db7b3
1 changed files with 13 additions and 2 deletions
|
@ -248,6 +248,7 @@ function useOutfitState() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const outfitStateReducer = (apolloClient) => (baseState, action) => {
|
const outfitStateReducer = (apolloClient) => (baseState, action) => {
|
||||||
|
console.log("[Outfit state] Action:", action);
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case "rename":
|
case "rename":
|
||||||
return produce(baseState, (state) => {
|
return produce(baseState, (state) => {
|
||||||
|
@ -304,7 +305,12 @@ const outfitStateReducer = (apolloClient) => (baseState, action) => {
|
||||||
wornItemIds.delete(itemId);
|
wornItemIds.delete(itemId);
|
||||||
closetedItemIds.add(itemId);
|
closetedItemIds.add(itemId);
|
||||||
|
|
||||||
reconsiderItems(itemIdsToReconsider, state, apolloClient);
|
reconsiderItems(
|
||||||
|
// Don't include the unworn item in items to reconsider!
|
||||||
|
itemIdsToReconsider.filter((x) => x !== itemId),
|
||||||
|
state,
|
||||||
|
apolloClient
|
||||||
|
);
|
||||||
});
|
});
|
||||||
case "removeItem":
|
case "removeItem":
|
||||||
return produce(baseState, (state) => {
|
return produce(baseState, (state) => {
|
||||||
|
@ -315,7 +321,12 @@ const outfitStateReducer = (apolloClient) => (baseState, action) => {
|
||||||
wornItemIds.delete(itemId);
|
wornItemIds.delete(itemId);
|
||||||
closetedItemIds.delete(itemId);
|
closetedItemIds.delete(itemId);
|
||||||
|
|
||||||
reconsiderItems(itemIdsToReconsider, state, apolloClient);
|
reconsiderItems(
|
||||||
|
// Don't include the removed item in items to reconsider!
|
||||||
|
itemIdsToReconsider.filter((x) => x !== itemId),
|
||||||
|
state,
|
||||||
|
apolloClient
|
||||||
|
);
|
||||||
});
|
});
|
||||||
case "setPose":
|
case "setPose":
|
||||||
return produce(baseState, (state) => {
|
return produce(baseState, (state) => {
|
||||||
|
|
Loading…
Reference in a new issue