Skip to content

Instantly share code, notes, and snippets.

@bobsilverberg
Last active August 24, 2018 21:01
Show Gist options
  • Save bobsilverberg/b84e344f670732dbbd6612d7017b58bc to your computer and use it in GitHub Desktop.
Save bobsilverberg/b84e344f670732dbbd6612d7017b58bc to your computer and use it in GitHub Desktop.
case CLEAR_ADDON_REVIEWS_FOR_REVIEWID: {
const {
payload: { reviewId },
} = action;
const newState = { ...state };
const reviewData = state.byId[reviewId];
if (reviewData) {
const { addonId, addonSlug, userId } = reviewData;
delete newState.byId[reviewId];
return {
...newState,
byAddon: {
...newState.byAddon,
[addonSlug]: undefined,
},
byUserId: {
...newState.byUserId,
[userId]: undefined,
},
groupedRatings: {
...newState.groupedRatings,
[addonId]: undefined,
},
};
}
return newState;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment