Skip to content

Commit

Permalink
refactor: rename references to the current state from prev to current
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinCupela committed Jan 28, 2025
1 parent 6e5ff15 commit 9f76e9f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/search_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,11 @@ export abstract class BaseSearchSource<T> implements SearchSource<T> {
stateUpdate.lastQueryError = e as Error;
} finally {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
this.state.next(({ lastQueryError, ...prev }: SearchSourceState<T>) => ({
...prev,
this.state.next(({ lastQueryError, ...current }: SearchSourceState<T>) => ({
...current,
...stateUpdate,
isLoading: false,
items: [...(prev.items ?? []), ...(stateUpdate.items || [])],
items: [...(current.items ?? []), ...(stateUpdate.items || [])],
}));
}
}
Expand Down Expand Up @@ -457,8 +457,8 @@ export class SearchController<StreamChatGenerics extends ExtendableGenerics = De
clear = () => {
this.cancelSearchQueries();
this.sources.forEach((source) => source.state.next({ ...source.initialState, isActive: source.isActive }));
this.state.next((prev) => ({
...prev,
this.state.next((current) => ({
...current,
isActive: true,
queriesInProgress: [],
searchQuery: '',
Expand All @@ -468,8 +468,8 @@ export class SearchController<StreamChatGenerics extends ExtendableGenerics = De
exit = () => {
this.cancelSearchQueries();
this.sources.forEach((source) => source.state.next({ ...source.initialState, isActive: source.isActive }));
this.state.next((prev) => ({
...prev,
this.state.next((current) => ({
...current,
isActive: false,
queriesInProgress: [],
searchQuery: '',
Expand Down

0 comments on commit 9f76e9f

Please sign in to comment.