mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-03-17 13:21:44 +01:00
fix JSON parse error on app handler
This commit is contained in:
parent
14d90d6e55
commit
64d9fde9b3
@ -19,7 +19,7 @@ import {
|
||||
Text,
|
||||
} from "@chakra-ui/react";
|
||||
import { NostrEvent, kinds, nip19 } from "nostr-tools";
|
||||
import { encodeDecodeResult, getProfileContent, ProfileContent } from "applesauce-core/helpers";
|
||||
import { encodeDecodeResult, getProfileContent } from "applesauce-core/helpers";
|
||||
|
||||
import { ExternalLinkIcon } from "../icons";
|
||||
import useTimelineLoader from "../../hooks/use-timeline-loader";
|
||||
@ -108,17 +108,27 @@ export default function AppHandlerModal({
|
||||
const autofocus = useBreakpointValue({ base: false, lg: true });
|
||||
const [search, setSearch] = useState("");
|
||||
|
||||
const filteredApps = apps.filter((app) => {
|
||||
if (search.length > 1) {
|
||||
const filteredApps = apps
|
||||
.filter((app) => {
|
||||
if (search.length > 1) {
|
||||
try {
|
||||
const parsed = getProfileContent(app);
|
||||
if (getDisplayName(parsed, app.pubkey).toLowerCase().includes(search.toLowerCase())) {
|
||||
return true;
|
||||
}
|
||||
} catch (error) {}
|
||||
return false;
|
||||
} else return true;
|
||||
})
|
||||
.filter((app) => {
|
||||
// filter out bad profiles in content
|
||||
try {
|
||||
const parsed = JSON.parse(app.content) as ProfileContent;
|
||||
if (getDisplayName(parsed, app.pubkey).toLowerCase().includes(search.toLowerCase())) {
|
||||
return true;
|
||||
}
|
||||
} catch (error) {}
|
||||
return false;
|
||||
} else return true;
|
||||
});
|
||||
getProfileContent(app);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
const callback = useTimelineCurserIntersectionCallback(loader);
|
||||
|
||||
return (
|
||||
|
Loading…
x
Reference in New Issue
Block a user