MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / SearchNotes

Function SearchNotes

integrations/raycast/src/search-notes.tsx:49–155  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

47 | `tag:${string}`;
48
49export default function SearchNotes(): ReactElement {
50 const [notes, setNotes] = useState<ZenNote[]>([]);
51 const [vaultRoot, setVaultRoot] = useState<string | null>(null);
52 const [isLoading, setIsLoading] = useState(true);
53 const [error, setError] = useState<LoadError | null>(null);
54 const [filter, setFilter] = useState<FilterValue>("all");
55
56 const load = useCallback(async () => {
57 setIsLoading(true);
58 setError(null);
59 try {
60 const nextNotes = await loadNotes();
61 const nextVaultRoot = await loadVaultRoot().catch(() => null);
62 setNotes(nextNotes);
63 setVaultRoot(nextVaultRoot);
64 } catch (err) {
65 setNotes([]);
66 setVaultRoot(null);
67 setError(toLoadError(err));
68 } finally {
69 setIsLoading(false);
70 }
71 }, []);
72
73 useEffect(() => {
74 void load();
75 }, [load]);
76
77 const emptyView = useMemo(() => {
78 if (!error) {
79 return (
80 <List.EmptyView
81 icon={Icon.MagnifyingGlass}
82 title="No notes found"
83 description="ZenNotes returned no notes for this vault."
84 actions={<RefreshActions onRefresh={load} />}
85 />
86 );
87 }
88
89 return (
90 <List.EmptyView
91 icon={Icon.Warning}
92 title={error.title}
93 description={error.message}
94 actions={<ErrorActions onRefresh={load} />}
95 />
96 );
97 }, [error, load]);
98
99 const filteredNotes = useMemo(
100 () => filterNotes(notes, filter),
101 [filter, notes],
102 );
103 const availableTags = useMemo(() => collectTags(notes), [notes]);
104
105 return (
106 <List

Callers

nothing calls this directly

Calls 9

loadVaultRootFunction · 0.90
toLoadErrorFunction · 0.90
loadNotesFunction · 0.85
filterNotesFunction · 0.85
collectTagsFunction · 0.85
noteKeywordsFunction · 0.85
noteAccessoriesFunction · 0.85
sortNotesFunction · 0.85
loadFunction · 0.50

Tested by

no test coverage detected