Skip to content

Commit

Permalink
⚡️ Make search popup recent faster to display (#2384)
Browse files Browse the repository at this point in the history
* Fix it

* Adjust query
  • Loading branch information
RomaricMourgues authored and Labels Bot committed Jul 3, 2022
1 parent 384f0ca commit 1c35cbf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import PasswordEncoder from "../../../../utils/password-encoder";
import assert from "assert";
import { localEventBus } from "../../../../core/platform/framework/pubsub";
import { ResourceEventsPayload } from "../../../../utils/types";
import { isNumber } from "lodash";
import { isNumber, isString } from "lodash";
import { RealtimeSaved } from "../../../../core/platform/framework";
import { getUserRoom } from "../../realtime";
import NodeCache from "node-cache";
Expand Down Expand Up @@ -236,6 +236,7 @@ export class UserServiceImpl implements UsersService {
}

async getCached(pk: UserPrimaryKey): Promise<User> {
if (!(pk.id && isString(pk.id))) return null;
if (this.cache.has(pk.id)) return this.cache.get<User>(pk.id);
const entity = await this.get(pk);
this.cache.set<User>(pk.id, entity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const useSearchChannels = () => {
const [searched, setSearched] = useRecoilState(SearchChannelsResultsState(companyId));
const [recent, setRecent] = useRecoilState(RecentChannelsState(companyId));

const opt = { limit: 100, company_id: companyId };
const opt = { limit: 25, company_id: companyId };

const refresh = async () => {
setLoading(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const useSearchMessagesFilesOrMedias = (mode: 'files' | 'medias') => {

const opt = _.omitBy(
{
limit: 100,
limit: 25,
is_file: mode === 'files' || undefined,
is_media: mode === 'medias' || undefined,
workspace_id: searchInput.workspaceId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const useSearchMessages = () => {

const opt = _.omitBy(
{
limit: 100,
limit: 50,
company_id: companyId,
workspace_id: searchInput.workspaceId,
channel_id: searchInput.channelId,
Expand Down

0 comments on commit 1c35cbf

Please sign in to comment.