Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions apps/desktop/src/components/finder/views/contact-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export function ContactView({ userId, initialPersonId, initialOrgId }: ContactVi
const { data: personSessions = [] } = useQuery({
queryKey: ["person-sessions", selectedPerson || "none"],
queryFn: async () => {
// Safety check - this should never run when selectedPerson is null
if (!selectedPerson) {
throw new Error("Query should not run when selectedPerson is null");
}
Expand Down Expand Up @@ -114,16 +113,16 @@ export function ContactView({ userId, initialPersonId, initialOrgId }: ContactVi
staleTime: 30 * 1000,
});

// Client-side filtering: filter allPeopleWithUser by organization when one is selected
const displayPeople = selectedOrganization
const isValidName = (name: string | null): boolean => {
return name !== null && name !== "" && name !== "Null";
};

const displayPeople = (selectedOrganization
? allPeopleWithUser.filter(person => person.organization_id === selectedOrganization)
: allPeopleWithUser;
: allPeopleWithUser).filter(person => isValidName(person.full_name));

const selectedPersonData = displayPeople.find(p => p.id === selectedPerson);

// Simple initialization - no complex useEffects needed
// Initial state is set directly in useState above

const handleSessionClick = (sessionId: string) => {
const path = { to: "/app/note/$id", params: { id: sessionId } } as const satisfies LinkProps;

Expand Down
Loading