This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /** | |
| * a worker (generator) to fetch anime domain data from the backend API | |
| **/ | |
| export function* fetchAnimeWorker(action: PayloadAction<{}>) { | |
| /** | |
| * get current pagination for this fetching | |
| **/ | |
| const curPagination: DomainPaginationType = yield select(mSelector.makeAnimePaginationDataSelector()) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /** | |
| * a worker (generator) to handle an api request for domain data with its input state | |
| * | |
| **/ | |
| export function* fetchAnimeWorker(action: PayloadAction<{}>) { | |
| /** | |
| * get current pagination for this fetching | |
| **/ | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /** | |
| * a UI component to dispatch an action to send an API request | |
| **/ | |
| const Search: React.FunctionComponent<{}> = (props) => { | |
| // retrieve current states from the redux store via the memorized selector | |
| const curSort = useSelector(mSelector.makeCurSortSelector()) | |
| const curSearchKeyword = useSelector(mSelector.makeSearchKeywordSelector()) | |
| const curCategory = useSelector(mSelector.makeCurCategorySelector()) | |
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /** | |
| * a worker (generator) to fetch anime data from the backend API | |
| * | |
| **/ | |
| export function* fetchAnimeWorker(action: PayloadAction<{}>) { | |
| // ... | |
| /** | |
| * get current sort for search | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /** | |
| * a UI component to dispatch an action to send an API request | |
| **/ | |
| const Search: React.FunctionComponent<{}> = (props) => { | |
| // retrieve current sort state from the redux store via the memorized selector | |
| const curSort = useSelector(mSelector.makeCurSortSelector()) | |
| // ... | |
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /** | |
| * app.curSort state Slice and its action type | |
| **/ | |
| export type curSortUpdateActionType = PayloadAction<SortType> | |
| export const curSortSlice = createSlice({ | |
| name: "app/curSort", // a name used in action type | |
| initialState: null, | |
| reducers: { | |
| /** | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /** | |
| * a UI component to handle sorting feature | |
| **/ | |
| const SearchController: React.FunctionComponent<SearchControllerPropsType> = ({ | |
| className, | |
| }) => { | |
| /** | |
| * sort feature | |
| **/ | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /** | |
| * a UI component to handle sorting feature | |
| **/ | |
| const SearchController: React.FunctionComponent<SearchControllerPropsType> = ({ | |
| className, | |
| }) => { | |
| /** | |
| * sort feature | |
| **/ | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /** | |
| * a watcher (generator) to watch anime fetching worker (the below worker) with its action type | |
| **/ | |
| export function* fetchAnimeWatcher() { | |
| /** | |
| * pick this action only once (most latest one) per 500ms no matter how many actions you dispatched. | |
| * | |
| * - 'debounce' built-in function is also a good candidate for typeahead. | |
| * debounce: pick this action only once after a given time no matter how many actions you dispatched. | |
| * | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /** | |
| * a UI component to dispatch an action to send an API request | |
| **/ | |
| const Search: React.FunctionComponent<{}> = (props) => { | |
| // retrieve current search keyword state from the redux store via the memorized selector | |
| const curSearchKeyword = useSelector(mSelector.makeSearchKeywordSelector()) | |
| // ... | |