Merge pull request #141 from christianbundy/fix-search
Fix search hanging when querying 3 or fewer chars
This commit is contained in:
commit
833e74ae8a
@ -14,6 +14,7 @@
|
||||
"LGPL",
|
||||
"Machinekit",
|
||||
"manyverse",
|
||||
"minlength",
|
||||
"monokai",
|
||||
"msgs",
|
||||
"multiserver",
|
||||
@ -31,10 +32,10 @@
|
||||
"roadmap",
|
||||
"sameorigin",
|
||||
"shortname",
|
||||
"systemctl",
|
||||
"socio",
|
||||
"ssbc",
|
||||
"summerfruit",
|
||||
"systemctl",
|
||||
"systemd",
|
||||
"unfollow",
|
||||
"unikitty",
|
||||
|
@ -507,8 +507,22 @@ exports.replyView = async ({ messages, myFeedId }) => {
|
||||
);
|
||||
};
|
||||
|
||||
exports.searchView = ({ messages, query }) =>
|
||||
template(
|
||||
exports.searchView = ({ messages, query }) => {
|
||||
const searchInput = input({
|
||||
name: "query",
|
||||
required: false,
|
||||
type: "search",
|
||||
value: query
|
||||
});
|
||||
|
||||
// - Minimum length of 3 because otherwise SSB-Search hangs forever. :)
|
||||
// https://github.com/ssbc/ssb-search/issues/8
|
||||
// - Using `setAttribute()` because HyperScript (the HyperAxe dependency has
|
||||
// a bug where the `minlength` property is being ignored. No idea why.
|
||||
// https://github.com/hyperhype/hyperscript/issues/91
|
||||
searchInput.setAttribute("minlength", 3);
|
||||
|
||||
return template(
|
||||
section(
|
||||
form(
|
||||
{ action: "/search", method: "get" },
|
||||
@ -517,7 +531,7 @@ exports.searchView = ({ messages, query }) =>
|
||||
{ for: "query" },
|
||||
"Add word(s) to look for in downloaded messages."
|
||||
),
|
||||
input({ required: true, type: "search", name: "query", value: query }),
|
||||
searchInput,
|
||||
button(
|
||||
{
|
||||
type: "submit"
|
||||
@ -528,3 +542,4 @@ exports.searchView = ({ messages, query }) =>
|
||||
),
|
||||
messages.map(msg => post({ msg }))
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user