Skip to content

Commit 1c35cbf

Browse files
Romaric MourguesLabels Bot
authored andcommitted
⚡️ Make search popup recent faster to display (#2384)
* Fix it * Adjust query
1 parent 384f0ca commit 1c35cbf

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

twake/backend/node/src/services/user/services/users/service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import PasswordEncoder from "../../../../utils/password-encoder";
2828
import assert from "assert";
2929
import { localEventBus } from "../../../../core/platform/framework/pubsub";
3030
import { ResourceEventsPayload } from "../../../../utils/types";
31-
import { isNumber } from "lodash";
31+
import { isNumber, isString } from "lodash";
3232
import { RealtimeSaved } from "../../../../core/platform/framework";
3333
import { getUserRoom } from "../../realtime";
3434
import NodeCache from "node-cache";
@@ -236,6 +236,7 @@ export class UserServiceImpl implements UsersService {
236236
}
237237

238238
async getCached(pk: UserPrimaryKey): Promise<User> {
239+
if (!(pk.id && isString(pk.id))) return null;
239240
if (this.cache.has(pk.id)) return this.cache.get<User>(pk.id);
240241
const entity = await this.get(pk);
241242
this.cache.set<User>(pk.id, entity);

twake/frontend/src/app/features/search/hooks/use-search-channels.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const useSearchChannels = () => {
5151
const [searched, setSearched] = useRecoilState(SearchChannelsResultsState(companyId));
5252
const [recent, setRecent] = useRecoilState(RecentChannelsState(companyId));
5353

54-
const opt = { limit: 100, company_id: companyId };
54+
const opt = { limit: 25, company_id: companyId };
5555

5656
const refresh = async () => {
5757
setLoading(true);

twake/frontend/src/app/features/search/hooks/use-search-files-or-medias.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const useSearchMessagesFilesOrMedias = (mode: 'files' | 'medias') => {
4040

4141
const opt = _.omitBy(
4242
{
43-
limit: 100,
43+
limit: 25,
4444
is_file: mode === 'files' || undefined,
4545
is_media: mode === 'medias' || undefined,
4646
workspace_id: searchInput.workspaceId,

twake/frontend/src/app/features/search/hooks/use-search-messages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const useSearchMessages = () => {
2525

2626
const opt = _.omitBy(
2727
{
28-
limit: 100,
28+
limit: 50,
2929
company_id: companyId,
3030
workspace_id: searchInput.workspaceId,
3131
channel_id: searchInput.channelId,

0 commit comments

Comments
 (0)