Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sorting and filtering studies #2362

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/ui/study/StudyIndexCtrl.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import * as xhr from './studyXhr'

import { PagerCategory, PagerData, PagerOrder } from '../../lichess/interfaces/study'

import { Paginator } from '../../lichess/interfaces'
import { batchRequestAnimationFrame } from '../../utils/batchRAF'
import debounce from 'lodash-es/debounce'
import { fromNow } from '../../i18n'
import { handleXhrError } from '../../utils'
import { batchRequestAnimationFrame } from '../../utils/batchRAF'
import redraw from '../../utils/redraw'
import router from '../../router'
import { Paginator } from '../../lichess/interfaces'
import { PagerData, PagerCategory, PagerOrder } from '../../lichess/interfaces/study'
import * as xhr from './studyXhr'

export interface PagerDataWithDate extends PagerData {
date: string
Expand Down Expand Up @@ -96,12 +98,12 @@ export default class StudyIndexCtrl {

public readonly onCatChange = (e: Event): void => {
const cat = (e.target as HTMLSelectElement).value
router.setQueryParams({ cat }, true)
router.setQueryParams({cat: cat, order: this.order }, true)
}

public readonly onOrderChange = (e: Event): void => {
const order = (e.target as HTMLSelectElement).value
router.setQueryParams({ order }, true)
router.setQueryParams({ cat: this.cat, order: order }, true)
}

public readonly onScroll = (e: Event): void => {
Expand Down