mirror of
https://gitlab.com/wheres-the-tp/ui-mobile.git
synced 2026-01-25 07:54:57 -06:00
debounce getFoodItems
This commit is contained in:
parent
d00a4f6ad3
commit
2d3a706333
1 changed files with 4 additions and 3 deletions
|
|
@ -4,6 +4,7 @@ import FoodItemRecord from '../records/FoodItemRecord';
|
|||
import AuthManager from '../AuthManager';
|
||||
import { addImage } from './ImagesApi';
|
||||
import { fetchRequest } from './FetchApi';
|
||||
import debounce from '../helpers/debounce';
|
||||
|
||||
export type FoodItemsFilter = {
|
||||
radius?: number,
|
||||
|
|
@ -28,8 +29,7 @@ export type FoodItemsForLocation = {
|
|||
fooditems: ?Array<RawFoodItem>,
|
||||
};
|
||||
|
||||
export const getFoodItems = memoizeWith(
|
||||
({ loc, filter }) => `${loc.coords.latitude + loc.coords.longitude}:${filter.toString()}`,
|
||||
export const getFoodItems = debounce(
|
||||
async ({
|
||||
loc,
|
||||
filter,
|
||||
|
|
@ -71,7 +71,8 @@ export const getFoodItems = memoizeWith(
|
|||
error: error,
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
300
|
||||
);
|
||||
|
||||
export const createFoodItem = async (foodItem: FoodItemRecord) => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue