Skip to content

Commit

Permalink
Handle previous data on useSearchItems
Browse files Browse the repository at this point in the history
  • Loading branch information
tassoevan committed Dec 31, 2024
1 parent 5f88a31 commit b20719f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/meteor/client/sidebarv2/header/hooks/useSearchItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const options = {
limit: LIMIT,
} as const;

// FIXME: the return type is UTTERLY wrong, but I'm not sure what it should be
export const useSearchItems = (filterText: string): UseQueryResult<SubscriptionWithRoom[] | undefined, Error> => {
const [, mention, name] = useMemo(() => filterText.match(/(@|#)?(.*)/i) || [], [filterText]);
const query = useMemo(() => {
Expand Down Expand Up @@ -108,6 +109,6 @@ export const useSearchItems = (filterText: string): UseQueryResult<SubscriptionW
},

staleTime: 60_000,
placeholderData: localRooms,
placeholderData: (previousData) => previousData ?? localRooms,
});
};

0 comments on commit b20719f

Please sign in to comment.