Skip to content

Commit

Permalink
Skip favorites dropdown loading state on init (#4318)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrieldutra authored Oct 31, 2019
1 parent 36638be commit 74dbb8a
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export default function FavoritesDropdown({ fetch, urlTemplate }) {
const noItems = isEmpty(items);
const urlCompiled = useMemo(() => template(urlTemplate), [urlTemplate]);

const fetchItems = useCallback(() => {
setLoading(true);
const fetchItems = useCallback((showLoadingState = true) => {
setLoading(showLoadingState);
fetch().$promise
.then(({ results }) => {
setItems(results);
Expand All @@ -27,7 +27,7 @@ export default function FavoritesDropdown({ fetch, urlTemplate }) {
}, [fetch]);

// fetch items on init
useEffect(fetchItems, []);
useEffect(() => fetchItems(false), []);

// fetch items on click
const onVisibleChange = visible => visible && fetchItems();
Expand Down

0 comments on commit 74dbb8a

Please sign in to comment.