improve jumpiness on search suggestions

This commit is contained in:
Sean Yesmunt 2020-12-11 13:42:54 -05:00
parent 120300643f
commit 05d625484d
3 changed files with 11 additions and 4 deletions

View file

@ -15,15 +15,22 @@ export default function useLighthouse(query: string, showMature?: boolean, size?
setLoading(true);
setResults(null);
let isSubscribed = true;
lighthouse
.search(throttledQuery)
.then(results => {
setResults(results.map(result => `lbry://${result.name}#${result.claimId}`));
setLoading(false);
if (isSubscribed) {
setResults(results.map(result => `lbry://${result.name}#${result.claimId}`));
setLoading(false);
}
})
.catch(() => {
setLoading(false);
});
return () => {
isSubscribed = false;
};
}
}, [throttledQuery]);

View file

@ -197,7 +197,7 @@
margin-bottom: var(--spacing-s);
@media (min-width: $breakpoint-small) {
padding: var(--spacing-s);
padding-left: 0;
}
}

View file

@ -39,7 +39,7 @@
--color-focus: #2d69a5;
--color-background-overlay: #212529d7;
--color-background: #1c1f22;
--color-background-overlay: #21252980;
--color-background-overlay: #21252999;
--color-border: #2f3337;
--color-card-background: #232629;
--color-card-background-highlighted: #384046;