mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
Fix performance optimizations for permission handling and session management (#32)
This commit is contained in:
1 parent
b28f069576
commit
923b70833d
3 files changed
+47
-12
No files matched your search
@@ -35,19 +35,21 @@ export const SessionList = ({
|
||||
|
||||
const filteredSessions = useMemo(() => {
|
||||
if (!sessions) return [];
|
||||
|
||||
const rootSessions = sessions.filter((session) => {
|
||||
|
||||
let filtered = sessions.filter((session) => {
|
||||
if (session.parentID) return false;
|
||||
if (directory && session.directory && session.directory !== directory) return false;
|
||||
return true;
|
||||
});
|
||||
|
||||
if (!searchQuery.trim()) return rootSessions;
|
||||
|
||||
const query = searchQuery.toLowerCase();
|
||||
return rootSessions.filter((session) =>
|
||||
(session.title || "Untitled Session").toLowerCase().includes(query),
|
||||
);
|
||||
if (searchQuery.trim()) {
|
||||
const query = searchQuery.toLowerCase();
|
||||
filtered = filtered.filter((session) =>
|
||||
(session.title || "Untitled Session").toLowerCase().includes(query),
|
||||
);
|
||||
}
|
||||
|
||||
return filtered.sort((a, b) => b.time.updated - a.time.updated);
|
||||
}, [sessions, searchQuery, directory]);
|
||||
|
||||
if (isLoading) {
|
||||
|
||||
Reference in new issue
Block a user