style: apply formatter to search
This commit is contained in:
@@ -448,7 +448,11 @@ const parseCommandPaletteResponse = (payload: unknown): CommandPaletteResponse =
|
|||||||
return { items: payload as CommandPaletteItem[], hasNextPage: false };
|
return { items: payload as CommandPaletteItem[], hasNextPage: false };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (payload && typeof payload === "object" && Array.isArray((payload as CommandPaletteResponse).items)) {
|
if (
|
||||||
|
payload &&
|
||||||
|
typeof payload === "object" &&
|
||||||
|
Array.isArray((payload as CommandPaletteResponse).items)
|
||||||
|
) {
|
||||||
const response = payload as CommandPaletteResponse;
|
const response = payload as CommandPaletteResponse;
|
||||||
return {
|
return {
|
||||||
items: response.items,
|
items: response.items,
|
||||||
@@ -536,7 +540,10 @@ const fetchNextSearchPage = (): void => {
|
|||||||
const page = nextSearchPage;
|
const page = nextSearchPage;
|
||||||
|
|
||||||
fetch(
|
fetch(
|
||||||
"/api/command-palette?q=" + encodeURIComponent(query) + "&page=" + encodeURIComponent(String(page)),
|
"/api/command-palette?q=" +
|
||||||
|
encodeURIComponent(query) +
|
||||||
|
"&page=" +
|
||||||
|
encodeURIComponent(String(page)),
|
||||||
)
|
)
|
||||||
.then((res: Response) => {
|
.then((res: Response) => {
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
@@ -576,7 +583,8 @@ const onResultsScroll = (): void => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const remainingScroll = searchResults.scrollHeight - searchResults.scrollTop - searchResults.clientHeight;
|
const remainingScroll =
|
||||||
|
searchResults.scrollHeight - searchResults.scrollTop - searchResults.clientHeight;
|
||||||
if (remainingScroll < 480) {
|
if (remainingScroll < 480) {
|
||||||
fetchNextSearchPage();
|
fetchNextSearchPage();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user