Avoid extra rename
action logs
This commit is contained in:
parent
76aca48b43
commit
e7ad4dc39e
1 changed files with 4 additions and 2 deletions
|
@ -118,7 +118,7 @@ function useOutfitSaving(outfitState, dispatchToOutfit) {
|
||||||
// tempting to do a full reset, in case the server knows something we
|
// tempting to do a full reset, in case the server knows something we
|
||||||
// don't, but we don't want to clobber changes the user made since
|
// don't, but we don't want to clobber changes the user made since
|
||||||
// starting the save!)
|
// starting the save!)
|
||||||
if (outfit.id === outfitState.id) {
|
if (outfit.id === outfitState.id && outfit.name !== outfitState.name) {
|
||||||
dispatchToOutfit({
|
dispatchToOutfit({
|
||||||
type: "rename",
|
type: "rename",
|
||||||
outfitName: outfit.name,
|
outfitName: outfit.name,
|
||||||
|
@ -145,7 +145,9 @@ function useOutfitSaving(outfitState, dispatchToOutfit) {
|
||||||
// Navigate to the new saved outfit URL. Our Apollo cache should pick
|
// Navigate to the new saved outfit URL. Our Apollo cache should pick
|
||||||
// up the data from this mutation response, and combine it with the
|
// up the data from this mutation response, and combine it with the
|
||||||
// existing cached data, to make this smooth without any loading UI.
|
// existing cached data, to make this smooth without any loading UI.
|
||||||
history.push(`/outfits/${outfit.id}`);
|
if (history.location.pathname !== `/outfits/${outfit.id}`) {
|
||||||
|
history.push(`/outfits/${outfit.id}`);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
|
Loading…
Reference in a new issue