Skip to content

Commit

Permalink
Fix: Initial Leaderboard filter params (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
GODrums authored Oct 2, 2024
1 parent e0c3fd3 commit 432391b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion webapp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"autoprefixer": "10.4.20",
"class-variance-authority": "0.7.0",
"clsx": "2.1.1",
"dayjs": "^1.11.13",
"dayjs": "1.11.13",
"lucide-angular": "0.429.0",
"postcss": "8.4.41",
"rxjs": "7.8.1",
Expand Down
5 changes: 3 additions & 2 deletions webapp/src/app/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { combineLatest, timer, lastValueFrom, map } from 'rxjs';
import { toSignal } from '@angular/core/rxjs-interop';
import { LeaderboardFilterComponent } from './leaderboard/filter/filter.component';
import { SkeletonComponent } from 'app/ui/skeleton/skeleton.component';
import dayjs from 'dayjs';

@Component({
selector: 'app-home',
Expand All @@ -21,8 +22,8 @@ export class HomeComponent {
// example: 2024-09-19
private readonly route = inject(ActivatedRoute);
private queryParams = toSignal(this.route.queryParamMap, { requireSync: true });
protected after = computed(() => this.queryParams().get('after') ?? undefined);
protected before = computed(() => this.queryParams().get('before') ?? undefined);
protected after = computed(() => this.queryParams().get('after') ?? dayjs().day(1).format('YYYY-MM-DD'));
protected before = computed(() => this.queryParams().get('before') ?? dayjs().format('YYYY-MM-DD'));

query = injectQuery(() => ({
queryKey: ['leaderboard', { after: this.after(), before: this.before() }],
Expand Down

0 comments on commit 432391b

Please sign in to comment.