Closed Pablo14697 closed 4 years ago
https://github.com/Liichi/CocktailFinder/blob/ed1265b1f8bd3f288fa37cc5e4e96b9db16cf097/src/reducers/search.ts#L30 Como veo en el sig codigo, lo unico que cambia es needUpdate. if(action.searchText === state.searchText) return { cocktails: action.cocktails, isFetching: false,searchText: state.searchText, error: false, needUpdate :false} else return { cocktails: action.cocktails, isFetching: false,searchText: state.searchText, error: false, needUpdate : true}
if(action.searchText === state.searchText) return { cocktails: action.cocktails, isFetching: false,searchText: state.searchText, error: false, needUpdate :false} else return { cocktails: action.cocktails, isFetching: false,searchText: state.searchText, error: false, needUpdate : true}
Entonces podrias reemplazar todo eso por
return { cocktails: action.cocktails, isFetching: false,searchText: state.searchText, error: false, needUpdate : action.searchText === state.searchText ? false : true}
Ahh es verdad no se me habia ocurrido. Arreglado.
https://github.com/Liichi/CocktailFinder/blob/ed1265b1f8bd3f288fa37cc5e4e96b9db16cf097/src/reducers/search.ts#L30 Como veo en el sig codigo, lo unico que cambia es needUpdate.
if(action.searchText === state.searchText) return { cocktails: action.cocktails, isFetching: false,searchText: state.searchText, error: false, needUpdate :false} else return { cocktails: action.cocktails, isFetching: false,searchText: state.searchText, error: false, needUpdate : true}
Entonces podrias reemplazar todo eso por
return { cocktails: action.cocktails, isFetching: false,searchText: state.searchText, error: false, needUpdate : action.searchText === state.searchText ? false : true}